API reference

Docstrings

MetaGraphsNext.DOTFormatType
struct DOTFormat <: AbstractGraphFormat end

If all metadata types support pairs or are Nothing, you can save MetaGraphs in DOTFormat.

source
MetaGraphsNext.MetaGraphType
MetaGraph{T<:Integer,Label,Graph,VertexData,EdgeData,GraphData,WeightFunction,U<:Real} <: AbstractGraph{T}

A graph type with custom vertex labels containing vertex-, edge- and graph-level metadata.

Vertex labels have type Label, while vertex (resp. edge, resp. graph) metadata has type VertexData (resp. EdgeData, resp. GraphData). It is recommended not to set Label to an integer type, so as to avoid confusion between vertex labels and vertex codes (which have type T<:Integer).

Fields

  • g::Graph: underlying, data-less graph with vertex indices of type T
  • vertex_labels::Dict{T,Label}: dictionary mapping vertex codes to vertex labels
  • vertex_properties::Dict{Label,Tuple{T,VertexData}}: dictionary mapping vertex labels to vertex codes & data
  • edge_data::Dict{Tuple{Label,Label},EdgeData}: dictionary mapping edge labels such as (label_u, label_v) to edge metadata
  • graph_data::GraphData: graph metadata
  • weight_function::WeightFunction: function defining edge weight from edge metadata
  • default_weight::U: default weight for the edges
source
MetaGraphsNext.MetaGraphMethod
MetaGraph(
    g;
    Label = Symbol,
    VertexData = Nothing,
    EdgeData = Nothing,
    graph_data = nothing,
    weight_function = edge_data -> 1.0,
    default_weight = 1.0
)

Construct an empty MetaGraph with the given metadata types and weights.

source
Base.getindexMethod
getindex(g, label_1, label_2)

Return edge metadata for the edge between label_1 and label_2.

source
Base.haskeyMethod
haskey(g, label_1, label_2)

Determine whether a graph g contains an edge from label_1 to label_2.

The order of label_1 and label_2 only matters if g is a digraph.

source
Base.haskeyMethod
haskey(g, label)

Determine whether a graph g contains the vertex label.

source
Base.setindex!Method
setindex!(g, data, label_1, label_2)

Set edge metadata for (label_1, label_2) to data.

source
Graphs.SimpleGraphs.add_edge!Method
add_edge!(g, label_1, label_2, data)

Add an edge (label_1, label_2) to MetaGraph g with metadata data.

Return true if the edge has been added, false otherwise.

source
Graphs.SimpleGraphs.add_vertex!Method
add_vertex!(g, label, data)

Add a vertex to MetaGraph g with label label having metadata data.

Return true if the vertex has been added, false incase the label already exists or vertex was not added.

source
Graphs.weightsMethod
weigths(g)

Return a matrix-like MetaWeights object containing the edge weights for graph g.

source
MetaGraphsNext.arrangeFunction
arrange(g, label_1, label_2)

Sort two vertex labels in a default order (useful to uniquely express undirected edges).

source
MetaGraphsNext.code_forMethod
code_for(g::MetaGraph, label)

Find the vertex code (or index) associated with label label.

This can be useful to pass to methods inherited from Graphs. Note, however, that vertex codes can be reassigned after vertex deletion.

source
MetaGraphsNext.label_forMethod
label_for(g::MetaGraph, v)

Find the label associated with code v.

This can be useful to interpret the results of methods inherited from Graphs. Note, however, that vertex codes can be reassigned after vertex deletion.

source
MetaGraphsNext.set_data!Method
set_data!(g, label_1, label_2, data)

Set edge metadata for (label_1, label_2) to data.

Return true if the operation succeeds, and false if g has no such edge.

source
MetaGraphsNext.set_data!Method
set_data!(g, label, data)

Set vertex metadata for label to data.

Return true if the operation succeeds, and false if g has no such vertex.

source

Index