Random Graphs

Random Graph Generation

A graph is needed as input for a GNN model. Random graph can be generated, which is provided by Graphs.jl package. A random graph can be generated by erdos_renyi model.

julia> using Graphs

julia> g = erdos_renyi(10, 30)
{10, 30} undirected simple Int64 graph

To construct a FeaturedGraph object, just put the graph object and its corresponding features into it.

julia> X = rand(Float32, 5, 10);

julia> fg = FeaturedGraph(g, nf=X)
FeaturedGraph:
	Undirected graph with (#V=10, #E=30) in adjacency matrix
	Node feature:	ℝ^5 <Matrix{Float32}>

Various random graph with different generating model can be used here.

julia> barabasi_albert(10, 3)
{10, 21} undirected simple Int64 graph

julia> watts_strogatz(10, 4, 0.3)
{10, 20} undirected simple Int64 graph

barabasi_albert generates graphs from scale-free network model, while watts_strogatz generates graphs from small-world model.

Common Graphs

There are commonly used graphs listed here.

clique_graph(k, n)
complete_graph(n)
grid(dims; periodic=false)
path_digraph(n)
path_graph(n)