Tulip  5.4.0
Large graphs analysis and drawing
PlanarityTest.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
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 
20 #ifndef TULIP_PLANARITYTESTX_H
21 #define TULIP_PLANARITYTESTX_H
22 
23 #include <list>
24 #include <tulip/tulipconf.h>
25 
26 namespace tlp {
27 
28 class Graph;
29 struct edge;
30 
31 /**
32  * @ingroup Checks
33  * @brief performs tests to check whether a graph is planar.
34  * From wikipedia: "A planar graph is a graph that can be embedded in the plane, i.e., it can be
35  *drawn on the plane in such a way that its edges intersect only at their endpoints."
36  **/
37 class TLP_SCOPE PlanarityTest {
38 public:
39  /*
40  The set of edges of the graph is modified during the execution of
41  the methods below. If you call one of them while iterating
42  on the edges of the graph, be careful to use a StableIterator
43  to avoid any possible invalidation of the iterator.
44  */
45 
46  /**
47  * @brief Checks whether the graph is planar (i.e. the graph can be drawn on the plane in such a
48  *way that no edges cross each other).
49  *
50  * @param graph The graph to check for planarity.
51  * @return bool True if the graph is planar, false otherwise.
52  * @note The graph is made biconnected to ease (?) the computation.
53  **/
54  static bool isPlanar(Graph *graph);
55 
56  /**
57  * Returns true if the current embedding of the graph is planar, false otherwise.
58  */
59  /**
60  * @brief Checks if the graph is plane (or a planar embedding).
61  * A planar graph *can* be drawn such as no edges cross each other, a plane graph *is* drawn such
62  *as no edges cross each other.
63  *
64  * @param graph The graph to check for a planar e;bedding.
65  * @return bool True if the graph is a planar embedding, false otherwise.
66  **/
67  static bool isPlanarEmbedding(const Graph *graph);
68 
69  /**
70  * @brief Makes a planar graph a planar embedding, i.e. makes a graph so that no edges cross each
71  *other if it is known to be possible.
72  * This modifies the order of the edges around the nodes.
73  *
74  * @param graph The graph to make a planar embedding of.
75  * @return bool True if the graph is planar, false otherwise.
76  **/
77  static bool planarEmbedding(Graph *graph);
78 
79  /**
80  * @brief Computes a list of edges that prevent the graph from being planar (i.e. part of the
81  *minor of K3,3 or K5).
82  *
83  * @param graph The graph on which to compute the obstruction edges.
84  * @return :list< tlp::edge, std::allocator< tlp::edge > > The obstruction edges.
85  **/
86  static std::list<edge> getObstructionsEdges(Graph *graph);
87 };
88 } // namespace tlp
89 #endif
performs tests to check whether a graph is planar. From wikipedia: "A planar graph is a graph that ca...
Definition: PlanarityTest.h:37