API reference

Metadata for graphs is stored as a series of named key-value pairs, with the key being an instance of type Symbol and the value being any type. The following methods are available for MetaGraphs:

MetaGraphs.clear_props!Method
clear_props!(g)
clear_props!(g, v)
clear_props!(g, e)
clear_props!(g, s, d)

Remove all defined properties from graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d).

source
MetaGraphs.filter_edgesMethod
filter_edges(g, prop[, val])
filter_edges(g, fn)

Return an iterator to all edges that have property prop defined (optionally as val), or where function fn returns true only for edges that should be included in the iterator.

fn should be of the form

fn(g::AbstractMetaGraph{T}, e::SimpleEdge{T})::Boolean

where e is replaced with the edge being evaluated.

source
MetaGraphs.filter_verticesMethod
filter_vertices(g, prop[, val])
filter_vertices(g, fn)

Return an iterator to all vertices that have property prop defined (optionally as val), or where function fn returns true only for vertices that should be included in the iterator.

fn should be of the form

fn(g::AbstractMetaGraph, v::Integer)::Boolean

where v is replaced with the vertex being evaluated.

source
MetaGraphs.get_propMethod
get_prop(g, prop::Symbol)
get_prop(g, prop::Symbol, default)

get_prop(g, v, prop::Symbol)
get_prop(g, v, prop::Symbol, default)

get_prop(g, e, prop::Symbol)
get_prop(g, e, prop::Symbol, default)
get_prop(g, s, d, prop::Symbol)
get_prop(g, s, d, prop::Symbol, default)

Return the property prop defined for graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d). Use the version with default, to return a default value if the property is not defined. Otherwise, it will return an error.

source
MetaGraphs.has_propMethod
has_prop(g, prop)
has_prop(g, v, prop)
has_prop(g, e, prop)
has_prop(g, s, d, prop)

Return true if the property prop is defined for graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d).

source
MetaGraphs.propsMethod
props(g)
props(g, v)
props(g, e)
props(g, s, d)

Return a dictionary of all metadata from graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d).

source
MetaGraphs.rem_prop!Method
rem_prop!(g, prop)
rem_prop!(g, v, prop)
rem_prop!(g, e, prop)
rem_prop!(g, s, d, prop)

Remove property prop from graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d). If property, vertex, or edge does not exist, will not do anything.

source
MetaGraphs.set_indexing_prop!Method
set_indexing_prop!(g, prop)
set_indexing_prop!(g, v, prop, val)

Make property prop into an indexing property. If any values for this property are already set, each vertex must have unique values. Optionally, set the index val for vertex v. Any vertices without values will be set to a default ("(prop)(v)").

source
MetaGraphs.set_prop!Method
set_prop!(g, prop, val)
set_prop!(g, v, prop, val)
set_prop!(g, e, prop, val)
set_prop!(g, s, d, prop, val)

Set (replace) property prop with value val in graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d). Will return false if vertex or edge does not exist, true otherwise.

source
MetaGraphs.set_props!Method
set_props!(g, dict)
set_props!(g, v, dict)
set_props!(g, e, dict)
set_props!(g, s, d, dict)

Bulk set (merge) properties contained in dict with graph g, vertex v, or edge e (optionally referenced by source vertex s and destination vertex d). Will return false if vertex or edge does not exist.

source
MetaGraphs.index_availableFunction
index_available(g, v, prop, val)

Check whether prop with val is available to be used as indexing for node v. First check whether prop is already an index. If not, check whether val already appears as an index in any node. If not, finally check whether prop and val indeed describe a property of node v.

source
MetaGraphs.default_index_valueFunction
default_index_value(v, prop, index_values; exclude=nothing)

Provides a default index value for a vertex if no value currently exists. The default is a string: "$prop$i" where prop is the property name and i is the vertex number. If some other vertex already has this name, a randomized string is generated (though the way it is generated is deterministic).

source
Graphs.SimpleGraphs.add_vertex!Function
add_vertex!(g)
add_vertex!(g, s, v)
add_vertex!(g, d)

Add a vertex to MetaGraph `g` with optional property `s` having value `v`,
or properties given by an optional Dicitionary `d` mapping symbols to values.

return true if the vertex has been added, false otherwise.
source
Graphs.SimpleGraphs.add_edge!Function
add_edge!(g, u, v, s, val)
add_edge!(g, u, v, d)

Add an edge `(u, v)` to MetaGraph `g` with optional property `s` having value `val`,
or properties given by an optional dictionary `d` mapping symbols to values.

return true if the edge has been added, false otherwise
source