Operators

Operators transform graphs to produce new graphs.

Function list

    Laplacians.adjMethod
    a,d = adj(sddm)

    Create an adjacency matrix and a diagonal vector from an SDD M-matrix. That is, from a Laplacian with added diagonal weights

    source
    Laplacians.diagmatMethod
    d = diagmat(a)

    Returns the diagonal weighted degree matrix(as a sparse matrix) of a graph

    source
    Laplacians.disjoinMethod
    graph = disjoin(a,b)

    Create a disjoint union of graphs a and b, with no edges between them.

    source
    Laplacians.join_graphs!Method
    graph = join_graphs!(a::IJV, b::IJV, k::Integer)

    Create a disjoint union of graphs a and b, and then put k random edges between them, merging b into a.

    source
    Laplacians.join_graphsMethod
    graph = joinGraphs(a, b, k::Integer)

    Create a disjoint union of graphs a and b, and then put k random edges between them

    source
    Laplacians.lapMethod
    l = lap(a)

    Create a Laplacian matrix from an adjacency matrix. We might want to do this differently, say by enforcing symmetry

    source
    Laplacians.line_graphMethod
    H = line_graph(G::SparseMatrixCSC)

    Let G = (V, E) be a graph. The line graph of G is the graph whose vertices are the edges of G in which two are connected if they share an endpoint in G. That is, (u, v),(w, z) is an edge of the line graph if one of {u, v} is the same as one of {w, z}

    source
    Laplacians.mapweightMethod
    b = mapweight(a, x->rand())

    Create a new graph that is the same as the original, but with f applied to each nonzero entry of a. For example, to make the weight of every edge uniform in [0,1], we could write.

    source
    Laplacians.plot_graphMethod
    plot_graph(gr,x,y,z;color=[0,0,1],dots=true,setaxis=true,number=false)

    Plots graph gr with coordinates (x,y,z)

    source
    Laplacians.plot_graphMethod
    plot_graph(gr,x,y;color=[0,0,1],dots=true,setaxis=true,number=false)

    Plots graph gr with coordinates (x,y)

    source
    Laplacians.shortIntGraphMethod
    graph = shortIntGraph(a::SparseMatrixCSC)

    Convert the indices in a graph to 32-bit ints. This takes less storage, but does not speed up much.

    source
    Laplacians.spectral_coordsMethod
    x, y = spectral_coords(a)

    Computes the spectral coordinates of a graph. If more than 2 coords are desired, you can use

        x, y, z = spectral_coords(a; k = 3)
    source
    Laplacians.subsampleEdgesMethod
    graph = subsampleEdges(a::SparseMatrixCSC, p::Float64)

    Create a new graph from the old, but keeping edge edge with probability p

    source
    Laplacians.thickenMethod
    a_new = thicken(A,k)

    Create a new graph with at least k times as many edges as A By connecting nodes with common neighbors at random. When this stops working (not enough new edges), repeat on the most recently produced graph. If k is too big, it is decreased so the average degree will not be pushed much above n/2.

    When called without k, it just runs thicken_once.

    For example:

    a = grid2(5)
    a2 = thicken(a,3)
    (x,y) = grid2coords(5,5);
    plotGraph(a2,x,y)
    source
    Laplacians.thicken_onceMethod
    a_new = thicken_once(a)

    Creates one edge for every vertex in a of degree > 1 by connecting two of its random neighbors. To use this to thicken a, return unweight(a + a_new).

    a = grid2(5)
    a2 = unweight(a + thicken_once(a))
    (x,y) = grid2coords(5,5);
    plotGraph(a2,x,y)
    source
    Laplacians.two_liftMethod
    graph = two_lift(a, flip::AbstractArray{Bool,1})
    graph = two_lift(a)
    graph = two_lift(a, k::Integer)

    Creats a 2-lift of a. flip is a boolean indicating which edges cross. In the third version, k is the number of edges that cross.

    source
    Laplacians.unweightMethod
    wt1 = unweight(a)

    Create a new graph in that is the same as the original, but with all edge weights 1

    source