Plotting Graphs

LightGraphs.jl integrates with several other Julia packages for plotting. Here are a few examples.


This excellent graph visualization package can be used with LightGraphs.jl as follows:

julia> g = wheel_graph(10); am = Matrix(adjacency_matrix(g))
julia> loc_x, loc_y = layout_spring_adj(am)
julia> draw_layout_adj(am, loc_x, loc_y, filename="wheel10.svg")

producing a graph like this:

Wheel Graph


Another nice graph visualization package. (TikzPictures.jl required to render/save):

julia> g = wheel_graph(10); t = plot(g)

julia> save(SVG("wheel10.svg"), t)

producing a graph like this:

Wheel Graph


Another graph visualization package that is very simple to use. Compose.jl is required for most rendering functionality:

julia> using GraphPlot, Compose

julia> g = wheel_graph(10)

julia> draw(PNG("/tmp/wheel10.png", 16cm, 16cm), gplot(g))


NetworkViz.jl is tightly coupled with LightGraphs.jl. Graphs can be visualized in 2D as well as 3D using ThreeJS.jl and Escher.jl.

#Run this code in Escher

using NetworkViz
using LightGraphs

main(window) = begin
  push!(window.assets, "widgets")
  g = complete_graph(10)

The above code produces the following output:

alt tag