Visualization of the Sunflower Graph
MultiscaleGraphSignalTransforms.SunFlowerGraph
— FunctionSunFlowerGraph(; N = 400)
SUNFLOWERGRAPH construct a simple weighted sunflower graph with N vertices. Edge weights are the reciprocal of Euclidean distances.
Input Arguments
N::Int64
: default is 400, the number of vertices. Requires N > 26.
Output Argument
G::SimpleWeightedGraph{Int64,Float64}
: a simple weighted graph of the sunflower.L::Matrix{Float64}
: the weighted unnormalized graph Laplacian matrix.X::Matrix{Float64}
: a matrix whose i-th row represent the 2D coordinates of the i-th node.
Let us see how to visualize the sunflower graph by gplot()
and scatter_gplot()
.
using MultiscaleGraphSignalTransforms, LightGraphs, Plots
# construct the sunflower graph
G, L, X = SunFlowerGraph(); N = nv(G)
# display the sunflower graph (node radii vary for visualization purpose)
gplot(1.0 * adjacency_matrix(G), X; width = 1)
scatter_gplot!(X; c = :red, ms = LinRange(1, 9, N))
plot!(frame = :none, size = (815, 500)) # hide
One can also represent a signal on the graph by colors. For example,
f = zeros(N)
f[1:200] .= 1
f[301:N] .= -1
# display the graph signal
gplot(1.0 * adjacency_matrix(G), X; width = 1)
scatter_gplot!(X; marker = f, ms = LinRange(1, 9, N))
plot!(frame = :none, size = (815, 500)) # hide