make_maximal_planar#
- graph_tool.generation.make_maximal_planar(g)[git][source]#
Add edges to the graph to make it maximally planar.
- Parameters:
- g
Graph Graph to be used. It must be planar.
- g
See also
graph_tool.structure.is_planarPlanarity test
graph_tool.structure.planar_facesFaces of a planar embedding
graph_tool.draw.planar_layoutStraight-line planar layout
Notes
A graph is maximal planar if no additional edges can be added to it without creating a non-planar graph. By Euler’s formula, a maximal planar graph with V > 2 vertices always has 3V - 6 edges and 2V - 4 faces.
The graph is first made connected and biconnected, with edges that keep it planar, so that the result has 3V - 6 edges for any planar graph with V > 2 vertices.
This algorithm runs in \(O(V + E)\) time.
References
Examples
>>> g = gt.lattice([10, 10]) >>> gt.make_maximal_planar(g) >>> gt.is_planar(g) True >>> print(g.num_vertices(), g.num_edges()) 100 294 >>> pos = gt.planar_layout(g) >>> gt.graph_draw(g, pos, output="maximal_planar.pdf") <...>
A maximally planar graph.#