IndexedBiDiGraph
A type representing directed graphs.
Use this when you need to access both inedges and outedges (or inneighbors and outneighbors). For a lighter data structure check out IndexedDiGraph.
IndexedGraphs.IndexedBiDiGraph — TypeIndexedBiDiGraph{T<:Integer} <: AbstractIndexedDiGraph{T}A type representing a sparse directed graph with access to both outedges and inedges.
FIELDS
A– square matrix filled withNullNumbers.A[i,j]corresponds to edgej=>i.X– square matrix for efficient access by row.X[j,i]points to the index of elementA[i,j]inA.nzval.
IndexedGraphs.IndexedBiDiGraph — MethodIndexedBiDiGraph(A::AbstractMatrix)Construct an IndexedBiDiGraph from the adjacency matrix A.
IndexedBiDiGraph internally stores the transpose of A. To avoid overhead due to the transposition, use IndexedBiDiGraph(transpose(At)) where At is the transpose of A.
Example:
using SparseArrays, IndexedGraphs
At = sprand(100, 100, 0.1) # At[i,j] corresponds to edge j=>i
for i in 1:100; At[i,i] = 0; end
dropzeros!(At)
g = IndexedBiDiGraph(transpose(At))
g.A.rowval === At.rowvaltrue