Reference
IndexedGraphs.LeftorRight
— TypeLeftorRight
LeftorRight = Union{Left, Right}
IndexedGraphs.AbstractIndexedDiGraph
— TypeAbstractIndexedDiGraph{T} <: AbstractIndexedGraph{T}
Abstract type for representing directed graphs.
IndexedGraphs.AbstractIndexedEdge
— TypeAbstractIndexedEdge{T<:Integer} <: AbstractEdge{T}
Abstract type for indexed edge. AbstractIndexedEdge{T}
s must have the following elements:
idx::T
integer positive index
IndexedGraphs.AbstractIndexedGraph
— TypeAbstractIndexedGraph{T} <: AbstractGraph{T}
An abstract type representing an indexed graph. AbstractIndexedGraph
s must have the following elements:
A::SparseMatrixCSC
adjacency matrix
IndexedGraphs.BipartiteGraphVertex
— TypeBipartiteGraphVertex
A BipartiteGraphVertex{LR<:LeftorRight,T<:Integer}
represents a vertex in a bipartite graph.
PARAMETERS
FIELDS
i
– The index of the vertex within its block.
IndexedGraphs.BipartiteIndexedGraph
— MethodBipartiteIndexedGraph(g::AbstractGraph)
Build a BipartiteIndexedGraph
from any undirected, bipartite graph.
IndexedGraphs.BipartiteIndexedGraph
— MethodBipartiteIndexedGraph(A::AbstractMatrix)
Construct a BipartiteIndexedGraph
from adjacency matrix A
with the convention that rows are vertices belonging to the left block, columns to the right block
IndexedGraphs.BipartiteIndexedGraph
— TypeBipartiteIndexedGraph{T<:Integer} <: AbstractIndexedGraph{T}
A type representing a sparse, undirected bipartite graph.
FIELDS
A
– adjacency matrix filled withNullNumber
s. Rows are vertices belonging to the left block, columns to the right blockX
– 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
.
IndexedGraphs.IndexedBiDiGraph
— MethodIndexedBiDiGraph(A::AbstractSimpleGraph)
Construct an IndexedBiDiGraph
from any AbstractSimpleGraph
(Graphs.jl), directed or otherwise.
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 withNullNumber
s.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.IndexedDiGraph
— MethodIndexedDiGraph(A::AbstractMatrix)
Constructs a IndexedDiGraph from the adjacency matrix A.
IndexedDiGraph
internally stores the transpose of A
. To avoid overhead due to the transposition, use IndexedDiGraph(transpose(At))
where At
is the transpose of A
.
IndexedGraphs.IndexedDiGraph
— MethodIndexedDiGraph(A::AbstractSimpleGraph)
Construct an IndexedDiGraph
from any AbstractSimpleGraph
(Graphs.jl), directed or otherwise.
IndexedGraphs.IndexedDiGraph
— TypeIndexedDiGraph{T<:Integer} <: AbstractIndexedDiGraph{T}
A type representing a sparse directed graph with access only to outedges.
FIELDS
A
– square matrix filled withNullNumber
s.A[i,j]
corresponds to an edgej=>i
IndexedGraphs.IndexedEdge
— TypeIndexedEdge{T<:Integer} <: AbstractIndexedEdge{T}
Edge type for IndexedGraph
s. Edge indices can be used to access edge properties stored in separate containers.
IndexedGraphs.IndexedGraph
— MethodIndexedGraph(A::AbstractMatrix)
Construct an IndexedGraph
from symmetric adjacency matrix A.
IndexedGraphs.IndexedGraph
— MethodIndexedGraph(A::SimpleGraph)
Construct an IndexedGraph
from undirected SimpleGraph
(Graphs.jl).
IndexedGraphs.IndexedGraph
— TypeIndexedGraph{T<:Integer} <: AbstractIndexedGraph{T}
A type representing a sparse undirected graph.
FIELDS
A
– square adjacency matrix.A[i,j] == A[j,i]
contains the unique index associated to unidrected edge(i,j)
IndexedGraphs.Left
— TypeLeft
Singleton type used to represent a vertex belonging to the left block in a BipartiteGraphVertex
IndexedGraphs.Right
— TypeRight
Singleton type used to represent a vertex belonging to the Right
block in a BipartiteGraphVertex
Graphs.LinAlg.adjacency_matrix
— Functionadjacency_matrix(g::BipartiteIndexedGraph, T::DataType=Int)
Return the symmetric adjacency matrix of size nv(g) = nv_left(g) + nv_right(g)
where no distinction is made between left and right nodes.
Graphs.degree
— Methoddegree(g::BipartiteIndexedGraph, v::BipartiteGraphVertex)
Return the degree of variable v
specified by a BipartiteGraphVertex
.
Graphs.edges
— Methodedges(g::IndexedGraph, i::Integer)
Return a lazy iterators to the edges incident to i
.
By default unordered edges sort source and destination nodes in increasing order. See outedges
and inedges
if you need otherwise.
Graphs.inneighbors
— Methodinneighbors(g::BipartiteIndexedGraph, v::BipartiteGraphVertex{<:LeftorRight})
Return a lazy iterator to the neighbors of variable v
specified by a BipartiteGraphVertex
.
Graphs.inneighbors
— Methodinneighbors(g::BipartiteIndexedGraph, i::Integer)
Return a lazy iterator to the neighbors of variable i
specified by its linear index.
Graphs.outneighbors
— Methodoutneighbors(g::BipartiteIndexedGraph, v::BipartiteGraphVertex{<:LeftorRight})
Return a lazy iterator to the neighbors of variable v
specified by a BipartiteGraphVertex
.
Graphs.outneighbors
— Methodoutneighbors(g::BipartiteIndexedGraph, i::Integer)
Return a lazy iterator to the neighbors of variable i
specified by its linear index.
IndexedGraphs.bidirected_with_mappings
— Methodbidirected_with_mappings(g::IndexedGraph) -> (gdir, dir2undir, undir2dir)
Construct an IndexedBiDiGraph
gdir
from an IndexedGraph
g
by building two directed edges per every undirected edge in g
. In addition, return two vectors containing mappings from the undirected edges of g
to the corresponding directed edges of gdir
.
OUTPUT
gdir
– The directed graphdir2undir
– A vector of integers mapping the indices of the directed edges ofgdir
to the corresponding undirected edges ofg
undir2dir
– A vector of vectors with two integers each mapping the indices of the undirected edges ofg
to the two corresponding directed edges ofgdir
IndexedGraphs.get_edge
— Methodget_edge(g::AbstractIndexedDiGraph, src::Integer, dst::Integer)
get_edge(g::AbstractIndexedDiGraph, id::Integer)
Get edge given source and destination or given edge index.
IndexedGraphs.get_edge
— Methodget_edge(g::IndexedGraph, src::Integer, dst::Integer)
get_edge(g::IndexedGraph, id::Integer)
Get edge given source and destination or given edge index.
IndexedGraphs.inedges
— Methodinedges(g::BipartiteIndexedGraph, v::BipartiteGraphVertex{<:LeftorRight})
Return a lazy iterator to the edges incident on a variable v
specified by a BipartiteGraphVertex
, with v
as the destination.
IndexedGraphs.inedges
— Methodinedges(g::BipartiteIndexedGraph, i::Integer)
Return a lazy iterator to the edges incident on a variable i
specified by its linear index, with i
as the destination.
IndexedGraphs.inedges
— Methodinedges(g::AbstractIndexedBiDiGraph, i::Integer)
Return a lazy iterator to the edges ingoing to node i
in g
.
IndexedGraphs.inedges
— Methodinedges(g::IndexedGraph, i::Integer)
Return a lazy iterators to the edges incident to i
with i
as the destination.
IndexedGraphs.linearindex
— Methodlinearindex(g::BipartiteIndexedGraph, v::BipartiteGraphVertex{LR}) where {LR<:LeftorRight}
linearindex(g::BipartiteIndexedGraph, i::Integer, ::Type{LR}) where LR<:LeftorRight
Return the linear index of a vertex, specified either by a BipartiteGraphVertex
or by its index and block.
IndexedGraphs.nv_left
— Methodnv_left(g::BipartiteIndexedGraph)
Return the number of vertices in the left block
IndexedGraphs.nv_right
— Methodnv_right(g::BipartiteIndexedGraph)
Return the number of vertices in the right block
IndexedGraphs.outedges
— Methodoutedges(g::AbstractIndexedDiGraph, i::Integer)
Return a lazy iterator to the edges outgoing from node i
in g
.
IndexedGraphs.outedges
— Methodoutedges(g::BipartiteIndexedGraph, v::BipartiteGraphVertex{<:LeftorRight})
Return a lazy iterator to the edges incident on a variable v
specified by a BipartiteGraphVertex
, with v
as the source.
IndexedGraphs.outedges
— Methodoutedges(g::BipartiteIndexedGraph, i::Integer)
Return a lazy iterator to the edges incident on a variable i
specified by its linear index, with i
as the source.
IndexedGraphs.outedges
— Methodoutedges(g::IndexedGraph, i::Integer)
Return a lazy iterators to the edges incident to i
with i
as the source.
IndexedGraphs.rand_bipartite_graph
— Methodrand_bipartite_graph([rng=default_rng()], nleft, nright, ned)
Create a bipartite graph with nleft
nodes in the left block, nright
nodes in the right block and ned
edges taken uniformly at random.
IndexedGraphs.rand_bipartite_graph
— Methodrand_bipartite_graph([rng=default_rng()], nleft, nright, p)
Create a bipartite graph with nleft
nodes in the left block, nright
nodes in the right block and edges taken independently with probability p
.
IndexedGraphs.rand_bipartite_tree
— Methodrand_bipartite_tree([rng=default_rng()], n)
Create a tree bipartite graph with n
vertices in total. The proportion of left/right nodes is random.
IndexedGraphs.rand_regular_bipartite_graph
— Methodrand_regular_bipartite_graph([rng=default_rng()], nleft, nright, k)
Create a bipartite graph with nleft
nodes in the left block, nright
nodes in the right block, where all left nodes have degree k
.
IndexedGraphs.vertex
— Methodvertex(g::BipartiteIndexedGraph, i::Integer)
Build the BipartiteGraphVertex
corresponding to linear index i
. Throws an error if i
is not in the range of vertices of g
IndexedGraphs.vertex
— Methodvertex(i::Integer, ::Type{<:LeftorRight})
Build a BipartiteGraphVertex
IndexedGraphs.vertex_left
— Methodvertex_left(g::BipartiteIndexedGraph, e::IndexedEdge)
Return the (in-block) index of the left-block vertex in e
.
IndexedGraphs.vertex_right
— Methodvertex_right(g::BipartiteIndexedGraph, e::IndexedEdge)
Return the (in-block) index of the right-block vertex in e
.
IndexedGraphs.vertices_left
— Methodvertices_left(g::BipartiteIndexedGraph)
Return a lazy iterator to the vertices in the left block
IndexedGraphs.vertices_right
— Methodvertices_right(g::BipartiteIndexedGraph)
Return a lazy iterator to the vertices in the right block
LinearAlgebra.issymmetric
— Methodissymmetric(g::IndexedBiDiGraph) -> Bool
Test whether a directed graph is symmetric, i.e. for each directed edge i=>j
there also exists the edge j=>i