API reference
MetaDataGraphs.AbstractDataGraph
— TypeAbstractDataGraph{T,VL,VD,ED,GD} <: AbstractGraph{T}
General template for graphs with metadata.
T<:Integer
is the type of verticesVL
is the type of vertex labels (cannot be a subtype ofInteger
)VD
is the type of vertex data objectsED
is the type of edge data objectsGD
is the type of the graph data object
MetaDataGraphs.DataDiGraph
— TypeDataDiGraph{T,VL,VD,ED,GD} <: AbstractDataGraph{T}
Structure for graphs with metadata based on adjacency list storage.
Fields
ne::Int
: number of edgesfadjlist::Vector{Vector{Int}}
: forward adjacency listsbadjlist::Vector{Vector{Int}}
: backward adjacency listslabels::Vector{VL}
: list of vertex labelsvertices::Dict{VL,T}
: dictionary mapping each vertex label to the associated integer indexv
vertex_data::Vector{VD}
: list of vertex data objects, indexed by integersv
edge_data::Vector{Vector{ED}}
: list of edge data objects, indexed bys
first andd_index
second, whered_index
is the rank ofd
among the outneighbors ofs
graph_data::GD
: single graph data object
MetaDataGraphs.DataDiGraph
— MethodDataDiGraph{T,VL,VD,ED}(graph_data)
Constructor taking only label and data types to create an empty DataDiGraph
.
Base.getindex
— Methodgetindex(g, label)
Alias for get_vertex(g, label)
, intended for dictionary-like use.
Base.haskey
— Methodhaskey(g, label)
Check whether a vertex with label label
exists.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(g, label_s, label_d, data)
Add an edge between the vertices with labels label_s
and label_d
, along with the associated data
.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(g::DataDiGraph, s, d, data)
Add an edge between vertices s
and d
, along with the associated data
.
Graphs.SimpleGraphs.add_vertex!
— Methodadd_vertex!(g::DataDiGraph, label, data)
Add a vertex with label label
, along with the associated data
.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(g, label_s, label_d)
Remove the edge between the vertices with labels label_s
and label_d
if it exists.
Graphs.SimpleGraphs.rem_vertex!
— Methodrem_vertex!(g, label)
Remove the vertex with label label
if it exists.
Graphs.has_edge
— Methodhas_edge(g, label_s, label_d)
Check whether an edge exists between the vertices with labels label_s
and label_d
.
Graphs.has_vertex
— Methodhas_vertex(g, label)
Check whether a vertex with label label
exists by calling haskey(g, label)
.
Graphs.weights
— Methodweights(g)
Compute the edge weights for an AbstractDataGraph
.
- If the edge data is of type
ED = Nothing
, return a lazy matrix full of ones. - If the edge data is of type
ED <: Real
, fill a sparse matrix with it. - If the edge data is of another type
ED
, try to use the attributeedge_data.weight
for each edge.
MetaDataGraphs.get_data
— Methodget_data(g, s, d)
Retrieve edge-level metadata for the edge between the vertices s
and d
.
MetaDataGraphs.get_data
— Methodget_data(g, v)
Retrieve vertex-level metadata for the vertex v
.
MetaDataGraphs.get_data
— Methodget_data(g)
Retrieve graph-level metadata.
MetaDataGraphs.get_data
— Methodget_data(g, label_s, label_d)
Retrieve edge-level metadata for the edge between the vertices with labels label_s
and label_d
.
MetaDataGraphs.get_data
— Methodget_data(g, label)
Retrieve vertex-level metadata for the vertex with label label
.
MetaDataGraphs.get_label
— Methodget_label(g, v)
Retrieve the label associated with vertex v
.
MetaDataGraphs.get_vertex
— Methodget_vertex(g, label)
Retrieve the vertex associated with label `label.
MetaDataGraphs.set_data!
— Methodset_data!(g, s, d, data)
Set edge-level metadata to value data
for edge (s, d)
.
MetaDataGraphs.set_data!
— Methodset_data!(g, label_s, label_d, data)
Set edge-level metadata to value data
for the edge between the vertices with labels label_s
and label_d
.
MetaDataGraphs.set_data!
— Methodset_data!(g, data)
Set graph-level metadata to value data
.
MetaDataGraphs.set_data!
— Methodset_data!(g, v, data)
Set vertex-level metadata to value data
for the vertex v
.
MetaDataGraphs.set_data!
— Methodset_data!(g, label, data)
Set vertex-level metadata to value data
for the vertex with label label
.