Alias for embed
Add an edge to this graph.
Add an edge to this graph. Throws an error if the source and target nodes don't exist in the graph.
Add multiple edges to this graph
Add a node to this graph.
Add a node to this graph. If this node already exists with a different label, its label will be replaced with this new one.
Add multiple nodes to this graph
Utility function for breadth-first search trees.
Breadth-first search remembering predecessor information.
Breadth-first search remembering predecessor information. Gives transient edges in breadth-first order, starting from the given node.
Breadth-first search remembering predecessor information.
Breadth-first search remembering predecessor information. Gives transient edges starting from the targets of the given edges, in breadth-first order.
Utility function for breadth-first search, remembering predecessor information.
Breadth-first search from the given node.
Breadth-first search from the given node. The result is ordered by distance
from the node v
.
Breadth-first search from the given node.
Breadth-first search from the given node. The result is a vector of results
of passing the context of each visited to the function f
.
Breadth-first search from the given nodes.
Breadth-first search from the given nodes. The result is the successors of
vs
, with immediate successors first.
Utility function for breadth-first search (nodes ordered by distance)
Breadth-first search from the given nodes.
Breadth-first search from the given nodes. The result is a vector of
results of passing the context of each visited node to the function f
.
Breadth-first search tree.
Breadth-first search tree. The result is a list of paths through the graph from the given vertex, in breadth-first order.
Returns a context focused on two nodes designated "first" and "last", if present, and the graph with those nodes removed.
Cheapest path from vertex s
to vertex t
under the cost function costFkt
with labels
Returns true if the given node is in the graph, otherwise false
Find the context for the given node.
Find the context for the given node. Causes an error if the node is not present in the graph.
Get all the contexts of this graph, as a graph.
Get all the contexts in the graph, as a vector.
Get all the contexts in the graph, as a vector. Note that the resulting contexts may overlap, in the sense that successive contexts in the result will contain vertices from previous contexts as well.
The number of nodes in this graph
Returns a context focused on the given node, if present, and the graph with that node removed.
Decompose this graph into the context for an arbitrarily chosen node and the rest of the graph.
The number of connections to and from the given node
Forward depth-first search.
Forward depth-first search.
A list of all the edges in the graph
The subgraph containing only edges that match the property
The subgraph containing only edges whose labels match the property
Map a function over the edge labels in the graph
Embed the given context in the graph.
Embed the given context in the graph. If the context's vertex is already in
the graph, removes the old context from the graph first. This operation is
the deterministic inverse of decomp
and obeys the following laws:
(g & c) decomp c.vertex == Decomp(Some(c), g)
(g decomp c.vertex).rest & c == (g & c)
Find all nodes that match the given ending criteria.
Check if the given node is an end node according to the given criteria.
Check if the given node is an end node according to the given criteria.
An ending node n
in graph g
has f(g,n)
containing no nodes other than n
.
The shortest path from vertex s
to vertex t
Build a graph out of a partial map of the contexts in this graph.
Find an edge between two nodes
Fold a function over the graph.
Fold a function over the graph. Note that each successive context received by the function will not contain vertices at the focus of previously received contexts. The first context will be an arbitrarily chosen context of this graph, but the next context will be arbitrarily chosen from a graph with the first context removed, and so on.
Fold a function over all the contexts in the graph.
Fold a function over all the contexts in the graph. Each context received by the
function will be an arbitrarily chosen context of this graph. Contrary to fold
,
this visits every node of the graph and gives you all incoming and outgoing adjacencies
for each node.
Map a function over the graph
Check if this graph has any loops, which connect a node to itself.
Check if this graph has multiple edges connecting any two nodes
The number of inbound edges from the given node
Find all inbound edges for the given node
All the inbound links of the given node, including self-edges
Check if the graph is empty
Check if the given node is a leaf of this graph
Check if the given node is a root of this graph
Check whether this graph is simple.
Check whether this graph is simple. A simple graph has no loops and no multi-edges.
A list of all the edges in the graph and their labels
A list of all the nodes in the graph and their labels
Find the label for a node
The subgraph containing only nodes whose labels match the property
The subgraph containing only labelled nodes that match the property
Utility function for labeled breadth-first search tree
Breadth-first search tree with labeled paths
Find the leaves of the graph.
Find the leaves of the graph. A leaf is a node which as no outgoing edges.
Shortest path from vertex s
to vertex t
, with labels
Breadth-first search giving the distance of each node from the node v
.
Breadth-first search giving the distance of each node from the search nodes.
Find the neighbors of a node
The subgraph containing only nodes that match the property
Map a function over the node labels in the graph
A list of all the nodes in the graph
The number of outbound edges from the given node
Find all outbound edges for the given node
All the outbound links of the given node, including self-edges
Find all nodes that have a link to the given node
Reverse depth-first search.
Reverse depth-first search. Follows predecessors.
Map a function over the contexts of this graph, and put the results in the labels.
Remove an edge from this graph
Remove multiple edges from this graph
Remove an edge from this graph only if the label matches
Remove a node from this graph
Remove multiple nodes from this graph
Reverse the direction of all edges
Find the roots of the graph.
Find the roots of the graph. A root is a node which has no incoming edges.
Add an edge to this graph.
Add an edge to this graph. If the source and target nodes don't exist in this graph,
return the given failover
graph.
Add multiple edges to this graph, ignoring edges whose source and target nodes don't already exist in the graph.
Project out (non-overlapping) contexts for which the given property is true.
Project out (non-overlapping) contexts for which the given property is true. Note that the contexts will not overlap, in the sense that successive contexts in the result will not contain the vertices at the focus of previous contexts.
Get all the contexts for which the given property is true.
Get all the contexts for which the given property is true. Note that the resulting contexts may overlap, in the sense that successive contexts in the result may contain vertices from previous contexts.
The subgraph containing only the given nodes
Find all nodes that have a link from the given node
Undirected depth-first search
Make the graph undirected, ensuring that every edge has an inverse.
Make the graph undirected, ensuring that every edge has an inverse. This takes edge labels into account when considering whether two edges are equal.
Adds all the nodes and edges from one graph to another.
Erase all labels in the graph
Replace an edge with a new one
Update multiple edges
Replace a node with a new one
Update multiple nodes
Map over the unique node identifiers in the graph
Generalized depth-first search.
Structural decomposition of a graph
Functions for extracting global information about a graph
Functions for extracting information about individual nodes and edges in a graph
Algorithms for depth-first traversal.
Algorithms for breadth-first traversal.
Queries to find starting and ending nodes, roots, and leaves.
Classification functions on graphs
An implementation of an inductive graph where nodes of type
N
are labeled withA
, and edges are labeled withB
.