Several of the layout algorithms produce not-very-useful layouts if the input graph is not connected, i.e., has more than one connected component.
For example:
using GLMakie, GraphMakie, Graphs
g = wheel_graph(4)
es = collect(edges(g))
g2 = Graph(vcat(es, [Edge(e.src + nv(g), e.dst + nv(g)) for e in es])) # make two unconnected copies of `g`
graphplot(g2; layout=Spring())
Produces:
Which has at least two issues:
- The two graphs are seemingly unnecessarily far apart.
- The layout of each individual component is worse than it would be for a single component (compare with
graphplot(g, layout=Spring()) below):
From testing, Stress, Spectral, and especially SFDP have this issue. Stress probably also has the issue, but it is less pronounced. E.g., here's graphplot(g2; layout=SFDP()):
I think it would make sense to apply these layout algorithms on the connected components of a graph individually, and then somehow layout their components subsequently.
Several of the layout algorithms produce not-very-useful layouts if the input graph is not connected, i.e., has more than one connected component.
For example:
Produces:
Which has at least two issues:
graphplot(g, layout=Spring())below):From testing,
Stress,Spectral, and especiallySFDPhave this issue.Stressprobably also has the issue, but it is less pronounced. E.g., here'sgraphplot(g2; layout=SFDP()):I think it would make sense to apply these layout algorithms on the connected components of a graph individually, and then somehow layout their components subsequently.