Graph Utilities

These are utilities to facilitate the use of sparse matrices as graphs.

Laplacians.backIndicesMethod

Computes the back indices in a graph in O(M+N). works if for every edge (u,v), (v,u) is also in the graph

source
Laplacians.compConductanceMethod

Returns the quality of the cut for a given graph and a given cut set s. the result will be |outgoing edges| / min(|vertices in set|, |N - vertices in set|)

source
Laplacians.flipIndexMethod

For a symmetric matrix, this gives the correspondance between pairs of entries in an ijv. So, ai[ind] = aj[flip[ind]]. For example,

(ai,aj,av) = findnz(a);
fl = flipIndex(a)
ind = 10
@show backind = fl[10]
@show [ai[ind], aj[ind], av[ind]]
@show [ai[backind], aj[backind], av[backind]];

backind = fl[10] = 4
[ai[ind],aj[ind],av[ind]] = [2.0,4.0,0.7]
[ai[backind],aj[backind],av[backind]] = [4.0,2.0,0.7]
source
Laplacians.setValueMethod

Sets the value of a certain edge in a sparse graph; value can be 0 without the edges dissapearing

source