If you want to explore even more possibilities that are possibly still experimental () , you could try Karnak.jl:
using Graphs
using SimpleWeightedGraphs
using Karnak
g = SimpleWeightedGraph(5)
add_edge!(g, 1, 2, 0.5)
add_edge!(g, 1, 3, 2.0)
add_edge!(g, 1, 4, 3.5)
add_edge!(g, 1, 5, 5.0)
@drawsvg begin
background("black")
sethue("gold")
drawgraph(g,
layout=vcat(
Point(0, -200), # point 1 is at the top
between.(Point(-200, 150), Point(200, 150), range(0, 1, length=4))
),
vertexshapesizes = 20,
edgestrokeweights =
(n, s, d, f, t) -> 2get_weight(g, s, d)
)
end
This is merely passing some calculated positions for the vertices.
If you want to use the buchheim
algorithm from NetworkLayout, you can do it like this;
g = SimpleWeightedDiGraph(5) # must be a Directed Graph
add_edge!(g, 1, 2, 0.5)
add_edge!(g, 1, 3, 2.0)
add_edge!(g, 1, 4, 3.5)
add_edge!(g, 1, 5, 5.0)
@drawsvg begin
background("black")
sethue("cyan")
drawgraph(g,
layout=buchheim,
edgestrokeweights =
(n, s, d, f, t) -> get_weight(g, s, d)
)
end
The NetworkLayout.Buchheim()
algorithm lets you also specify the vertex spacing:
...
layout=Buchheim(nodesize=[1.0, 4.0, 8.0, 16.0]),
...