The planar graph test
Planar graphs are graphs that can be drawn on a plane without any intersecting edges. In order to draw them, you have to start from a vertex, draw from edge to edge, and keep track of the faces as the drawing continues. According to Kuratowski, a graph is planar if it does not contain a subgraph that is part of the complete graph on five vertices.
The following is a simple example of a planar graph:
Euler's formula connects a number of vertices, edges, and faces. According to Euler's formula, if a finite and connected planar graph is drawn in the plane without any intersecting edge, and if v represents the number of vertices, e represents the number of edges, and f represents the number of faces, then v − e + f = 2.
Besides Mayavi
, NetworkX
, and planarity
, you can use the gamera
package to create and display graphs. However, gamera
is only available on Windows. We have a simple example here that uses planarity
and NetworkX
:
import planarity import networkx...