Deterministic Graph Generators
Static Graphs
Erdos.jl implements a collection of classic graph generators:
Erdos.BinaryTree
— MethodBinaryTree(levels, G=Graph)
Creates a binary tree with k-levels vertices are numbered 1:2^levels-1
Erdos.CliqueGraph
— MethodCliqueGraph(k, n, G=Graph)
This function generates a graph with n
k
-cliques connected circularly by n
edges.
Erdos.CompleteBipartiteGraph
— MethodCompleteBipartiteGraph(n1, n2, G = Graph)
Creates a complete bipartite graph with n1+n2
vertices. It has edges connecting each pair of vertices in the two sets.
Erdos.CompleteDiGraph
— MethodCompleteDiGraph(n, G = DiGraph)
Creates a complete digraph with n
vertices. A complete digraph has edges connecting each pair of vertices (both an ingoing and outgoing edge).
Erdos.CompleteGraph
— MethodCompleteGraph(n, G = Graph)
Creates a complete graph of type G
with n
vertices. A complete graph has edges connecting each pair of vertices.
Erdos.CycleDiGraph
— MethodCreates a cycle digraph with n
vertices. A cycle digraph is a closed path digraph.
Erdos.CycleGraph
— MethodCycleGraph(n, G=Graph)
Creates a cycle graph with n
vertices. A cycle graph is a closed path graph.
Erdos.DoubleBinaryTree
— MethodDoubleBinaryTree(levels, G=Graph)
Create a double complete binary tree with k-levels used as an example for spectral clustering by Guattery and Miller 1998.
Erdos.Grid
— MethodGrid(dims::AbstractVector, G=Graph; periodic=false)
Creates a d
-dimensional cubic lattice, with d=length(dims)
and length dims[i]
in dimension i
. If periodic=true
the resulting lattice will have periodic boundary condition in each dimension.
Erdos.PathDiGraph
— MethodPathDiGraph(n, G = DiGraph)
Creates a path digraph with n
vertices. A path graph connects each successive vertex by a single directed edge.
Erdos.PathGraph
— MethodPathGraph(n, G = Graph)
Creates a path graph with n
vertices. A path graph connects each successive vertex by a single edge.
Erdos.RoachGraph
— MethodThe Roach Graph from Guattery and Miller 1998
Erdos.StarDiGraph
— MethodCreates a star digraph with n
vertices. A star digraph has a central vertex with directed edges to every other vertex.
Erdos.StarGraph
— MethodStarGraph(n, G = Graph)
Creates a star graph with n
vertices. A star graph has a central vertex with edges to each other vertex.
Erdos.WheelDiGraph
— MethodCreates a wheel digraph with n
vertices. A wheel graph is a star digraph with the outer vertices connected via a closed path graph.
Erdos.WheelGraph
— MethodWheelGraph(n, G=Graph)
Creates a wheel graph with n
vertices. A wheel graph is a star graph with the outer vertices connected via a closed path graph.
Small Graphs
Other classical graphs can be generated by the following function:
Erdos.digraph
— Methoddigraph{G<:AGraph}(n, edgelist::Vector{Tuple{Int,Int}},
G = Graph)
Build a digraph with n
vertices, type G
, and given edgelist
.
Erdos.digraph
— Methoddigraph(s::Symbol, G = DiGraph)
Creates a notorious digraph s
of type G
. Admissible values for s
are:
s | graph type |
---|---|
:truncatedtetrahedron | A skeleton of the truncated tetrahedron digraph. |
Erdos.graph
— Methodgraph{G<:AGraph}(n, edgelist::Vector{Tuple{Int,Int}},
G = Graph)
Build a graph with n
vertices, of type G
, and given edgelist
.
Erdos.graph
— Methodgraph(s::Symbol, G = Graph)
Creates a notorious graph s
of type G
. Admissible values for s
are:
s | graph type |
---|---|
:bull | A bull graph. |
:chvatal | A Chvátal graph. |
:cubical | A Platonic cubical graph. |
:desargues | A Desarguesgraph. |
:diamond | A diamond graph. |
:dodecahedral | A Platonic dodecahedral graph. |
:frucht | A Frucht graph. |
:heawood | A Heawood graph. |
:house | A graph mimicing the classic outline of a house. |
:housex | A house graph, with two edges crossing the bottom square. |
:icosahedral | A Platonic icosahedral graph. |
:krackhardtkite | A Krackhardt-Kite social network graph. |
:moebiuskantor | A Möbius-Kantor graph. |
:octahedral | A Platonic octahedral graph. |
:pappus | A Pappus graph. |
:petersen | A Petersen graph. |
:sedgewickmaze | A simple maze graph used in Sedgewick's Algorithms in C++: Graph Algorithms (3rd ed.) |
:tetrahedral | A Platonic tetrahedral graph. |
:truncatedcube | A skeleton of the truncated cube graph. |
:truncatedtetrahedron | A skeleton of the truncated tetrahedron graph. |
:tutte | A Tutte graph. |
A collection of real world graphs is available through the readgraph
function.
Euclidean Graphs
Generation of random and static graphs embedded in Euclidean space.
Erdos.euclidean_graph
— Methodeuclidean_graph(points::Matrix, G; L=1., p=2., cutoff=Inf, bc=:periodic)
Given the d×N
matrix points
builds an Euclidean graph of N
vertices according to the following procedure.
Defining the d
-dimensional vectors x[i] = points[:,i]
, an edge between vertices i
and j
is inserted if norm(x[i]-x[j], p) < cutoff
. In case of negative cutoff
instead every edge is inserted. For p=2
we have the standard Euclidean distance. Set bc=:periodic
to impose periodic boundary conditions in the box $[0,L]^d$. Set bc=:open
for open boundary condition. In this case the keyword argument L
will be ignored.
Returns a graph and Dict containing the distance on each edge.