Consider the graph given by
graph = Graph[{2 <-> 1, 3 <-> 1, 7 <-> 1, 5 <-> 1, 6 <-> 1, 3 <-> 2, 4 <-> 3,
4 <-> 7, 4 <-> 5, 7 <-> 5, 6 <-> 5, 2 <-> 6}]
Via Steinitz's theorem, this is the vertex graph of a convex polyhedron:
KVertexConnectedGraphQ[graph, 3] && PlanarGraphQ[graph]
-> True
How can one construct that polyhedron (i.e. a spatial representation of it) from the graph? Embedding the graph in 3-space using GraphPlot3D
comes close, but does not actually build a polyhedron as the side view reveals:
GraphPlot3D[graph, Boxed -> False,
EdgeRenderingFunction -> (Cylinder[#1, .05] &),
VertexRenderingFunction -> (Sphere[#1, .1] &)]
(Note how the quadrilateral face is "bent".)
I have experimented with various embeddings such as "SpringEmbedding"
, "SpringElectricalEmbedding"
etc. but none of them seem to produce a true polyhedron even from this simple graph. I am aware that the polyhedron representation of a polyhedral graph is not unique (maybe not even topologically unique(?)) but any embedding that is a polyhedron would suffice. The polyhedral graphs supplied in Mathematica's graph database all come with such embeddings, so I am confident this must be possible.