Tulip  4.8.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
TriconnectedTest.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef TULIP_TRICONNECTEDTEST_H
23 #define TULIP_TRICONNECTEDTEST_H
24 
25 #include <tulip/tuliphash.h>
26 #include <tulip/Observable.h>
27 #include <tulip/Graph.h>
28 
29 namespace tlp {
30 
31 /**
32  * @ingroup Checks
33  * @brief Provides functions to test if a graph is Triconnected.
34  **/
35 class TLP_SCOPE TriconnectedTest : private Observable {
36 public:
37 
38  /**
39  * Returns true if the graph is triconnected (i.e. a connected graph such that deleting any two nodes (and incident edges)
40  * results in a graph that is still connected), false otherwise.
41  */
42  /**
43  * @brief Checks if the graph is triconnected.
44  * Creates a clone sugraph in which to operate, then iterates over the nodes, and deletes them.
45  * Once the node is deleted, checks if the graph is biconnected.
46  * If it is not, then the graph is not triconnected.
47  * If it is, adds back the node and its edges.
48  *
49  * @param graph The graph to check is triconnected.
50  * @return bool True if the graph is triconnected, false otherwise.
51  **/
52  static bool isTriconnected(Graph *graph);
53 
54 private:
55  TriconnectedTest();
56 
57  bool compute(tlp::Graph* graph);
58  // override Observable::treatEvent
59  void treatEvent(const Event&);
60 
61  /**
62  * @brief Singleton instance of this class.
63  **/
64  static TriconnectedTest * instance;
65  /**
66  * @brief Stored results for graphs. When a graph is updated, its entry is removed from the hashmap.
67  **/
68  TLP_HASH_MAP<const Graph*, bool> resultsBuffer;
69 };
70 
71 
72 }
73 #endif
74 ///@endcond