generators

Generators

Laplacians.jl implements generators for many standard graphs. The chimera and wted_chimera generators are designed to stress code by combining these standard graphs in tricky ways. While no one of these graphs need be a hard case for any application, the goal is for these generators to explore the space of graphs in such a way that running on many of them should exercise your code.

chimera(n) generates a random chimera graph. chimera(n,k) first sets the seed of the psrg to k. In this way, it generates the kth chimera graph, and messes with your psrg. wted_chimera is similar, but it generates weighted graphs.

Function list

graph = ErdosRenyi(n::Integer, m::Integer; ver=Vcur)

Generate a random graph on n vertices with m edges. The actual number of edges will probably be smaller, as we sample with replacement

graph = ErdosRenyiCluster(n::Integer, k::Integer; ver=Vcur)

Generate an ER graph with average degree k, and then return the largest component. Will probably have fewer than n vertices. If you want to add a tree to bring it back to n, try ErdosRenyiClusterFix.

graph = ErdosRenyiClusterFix(n::Integer, k::Integer; ver=Vcur)

Like an Erdos-Renyi cluster, but add back a tree so it has n vertices

Laplacians.chimeraMethod.
graph = chimera(n::Integer, k::Integer; verbose=false, ver=Vcur)

Builds the kth chimeric graph on n vertices. It does this by resetting the random number generator seed. It should captute the state of the generator before that and then return it, but it does not yet.

Laplacians.chimeraMethod.
graph = chimera(n::Integer; verbose=false, ver=Vcur)

Builds a chimeric graph on n vertices. The components come from pureRandomGraph, connected by joinGraphs, productGraph and generalizedNecklace

graph = completeBinaryTree(n::Int64)

The complete binary tree on n vertices

graph = complete_bipartite_graph(n)
graph = complete_graph(n)
ijv = empty_graph(n)
graph = generalized_ring(n, gens)

A generalization of a ring graph. The vertices are integers modulo n. Two are connected if their difference is in gens. For example,

generalized_ring(17, [1 5])
Laplacians.grid2Method.
graph = grid2(n::Int64, m::Int64; isotropy=1)

An n-by-m grid graph. iostropy is the weighting on edges in one direction.

graph = grid2coords(n::Int64, m::Int64)
graph = grid2coords(n::Int64)

Coordinates for plotting the vertices of the n-by-m grid graph

Laplacians.grid3Method.
graph = grid3(n1, n2, n3)
graph = grid3(n)

An n1-by-n2-by-n3 grid graph.

graph = grown_graph(n, k; ver=Vcur)

Create a graph on n vertices. For each vertex, give it k edges to randomly chosen prior vertices. This is a variety of a preferential attachment graph.

graph = grown_graph_d(n::Integer, k::Integer; ver=Vcur)

Like a grownGraph, but it forces the edges to all be distinct. It starts out with a k+1 clique on the first k vertices

graph = hyperCube(d::Int64)

The d dimensional hypercube. Has 2^d vertices and d*2^(d-1) edges.

graph = path_graph(n)
graph = pref_attach(n::Int64, k::Int64, p::Float64; ver=Vcur)

A preferential attachment graph in which each vertex has k edges to those that come before. These are chosen with probability p to be from a random vertex, and with probability 1-p to come from the endpoint of a random edge. It begins with a k-clique on the first k+1 vertices.

graph = pure_random_graph(n::Integer; verbose=false, ver=Vcur)

Generate a random graph with n vertices from one of our natural distributions

graph = rand_gen_ring(n, k; verbose = false, ver=Vcur)

A random generalized ring graph of degree k. Gens always contains 1, and the other k-1 edge types are chosen from an exponential distribution

graph = rand_matching(n::Integer; ver=Vcur)

A random matching on n vertices

graph = rand_regular(n, k; ver=Vcur)

A sum of k random matchings on n vertices

graph = randWeight(graph; ver=Vcur)

Applies one of a number of random weighting schemes to the edges of the graph

graph = ring_graph(n)
graph = semiwted_chimera(n::Integer; verbose=false, ver=Vcur)

A Chimera graph with some weights. The weights just appear when graphs are combined. For more interesting weights, use wted_chimera

graph = star_graph(n)
graph = wted_chimera(n::Integer, k::Integer; verbose=false, ver=Vcur)

Builds the kth wted chimeric graph on n vertices. It does this by resetting the random number generator seed. It should captute the state of the generator before that and then return it, but it does not yet.

graph = wted_chimera(n::Integer)

Generate a chimera, and then apply a random weighting scheme

Random.randpermMethod.
graph = randperm(mat::AbstractMatrix)
        randperm(f::Expr)

Randomly permutes the vertex indices