Directed graph utilities - Factor Documentation (original) (raw)

Words for treating associative mappings as directed graphs can be found in the graphs vocabulary. A directed graph is represented as an assoc mapping each vertex to a hash-set of edges entering that vertex.

To create a new graph, just create an assoc, for example by calling . To add vertices and edges to a graph:

To remove vertices from the graph:

Since graphs are represented as assocs, they can be cleared out by calling clear-assoc.

You can perform queries on a graph:

Directed graphs are used to maintain cross-referencing information for Definitions.