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.IndexedBiDiGraphType
IndexedBiDiGraph{T<:Integer} <: AbstractIndexedDiGraph{T}

A type representing a sparse directed graph with access to both outedges and inedges.

FIELDS

  • A – square matrix filled with NullNumbers. A[i,j] corresponds to edge j=>i.
  • X – square matrix for efficient access by row. X[j,i] points to the index of element A[i,j] in A.nzval.
source
IndexedGraphs.IndexedBiDiGraphMethod
IndexedBiDiGraph(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.

source

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.rowval
true