Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces 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 1 and Inria Bordeaux - Sud Ouest
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 
28 namespace tlp {
29 
30 class Graph;
31 
32 /**
33  * @ingroup Checks
34  * @brief Provides functions to test if a graph is Triconnected.
35  **/
36 class TLP_SCOPE TriconnectedTest : private Observable {
37 public:
38 
39  /**
40  * Returns true if the graph is triconnected (i.e. a connected graph such that deleting any two nodes (and incident edges)
41  * results in a graph that is still connected), false otherwise.
42  */
43  /**
44  * @brief Checks if the graph is triconnected.
45  * Creates a clone sugraph in which to operate, then iterates over the nodes, and deletes them.
46  * Once the node is deleted, checks if the graph is biconnected.
47  * If it is not, then the graph is not triconnected.
48  * If it is, adds back the node and its edges.
49  *
50  * @param graph The graph to check is triconnected.
51  * @return bool True if the graph is triconnected, false otherwise.
52  **/
53  static bool isTriconnected(Graph *graph);
54 
55 private:
56  TriconnectedTest();
57 
58  bool compute(tlp::Graph* graph);
59  // override Observable::treatEvent
60  void treatEvent(const Event&);
61 
62  /**
63  * @brief Singleton instance of this class.
64  **/
65  static TriconnectedTest * instance;
66  /**
67  * @brief Stored results for graphs. When a graph is updated, its entry is removed from the hashmap.
68  **/
69  TLP_HASH_MAP<unsigned long,bool> resultsBuffer;
70 };
71 
72 
73 }
74 #endif
75 ///@endcond