Cross posted to Wolfram Community
Mathematica has a layout algorithm to plot planar graphs without edge crossings. This typically produces an ugly triangular layout where some vertices and edges are nearly overlapping (even if technically they do not intersect).
@JasonB posted this example in chat:
g = Graph[EdgeList@ChemicalData["FullereneC60", "StructureGraph"],
GraphLayout -> "PlanarEmbedding"]
How can we create a more pleasing visualizaton of planar graphs than this?
GraphData
has the same fullerene graph with much nicer vertex coordinates included:
GraphData[{"Fullerene", {60, 1}}]
How could we create something comparable (if not quite as symmetric) automatically?
I am looking for practical methods. They do not need to work on all planar graphs, and it is okay if they need manual tuning. But they should be practically useful for visualizing some large class of planar graphs.
GraphData["Planar"]
gives a long list of graphs that you can use for testing. GraphData["Planar", 20]
gives some planar graphs with 20 vertices.
Some graphs will plot well (and without edge crossings) using a simple SpringElectricalEmbedding
, even when the method in the below answer fails on them. An example is GraphData[{"SierpinskiCarpet", 4}]
.
One particularly challenging graph is GraphData[{"Apollonian", 5}]
. Can you plot this one nicely?
Bounty update:
There may be multiple different approaches which work in specific situations only. Feel free to post these as well. One possibility is using a SpringElectrical type embedding in 3D, then projecting it down to the plane in such a way as to maintain symmetries (which is the hard part: projecting is easy, maintaining symmetries is not).
Since more than one method may work, and since methods that only work on a subclass of graphs may have high practical utility, I may award additional smaller bounties to good answers even after the 300 bounty is gone.
GraphData
is the same as $C_{60}$. The central pentagon is adjacent to five other pentagons. $\endgroup$