Owl_graphSourceGraph module supports basic operations on DAG.
type definition of a node
val node :
?id:int ->
?name:string ->
?prev:'a node array ->
?next:'a node array ->
'a ->
'a node``node ~id ~name ~prev ~next attr`` creates a node with given id and name string. The created node is also connected to parents in ``prev`` and children in ``next``. The ``attr`` will be saved in ``attr`` field.
``connect parents children`` connects a set of parents to a set of children. The created links are the Cartesian product of parents and children.
``remove_node x`` removes node ``x`` from the graph by disconnecting itself from all its parent nodes and child nodes.
``remove_edge src dst`` removes a link ``src -> dst`` from the graph. Note that it does not remove dst -> src if there exists one.
``copy ~dir x`` makes a copy of ``x`` and all its ancestors (if ``dir = Ancestor``) or all its descendants (if ``dir = Descendant``).
Note that this function only makes a copy of the graph structure, ``attr`` fileds of the nodes in the new graph share the same memory with those in the original graph.
Iterate the ancestors of a given node.
Iterate the descendants of a given node.
Filter the ancestors of a given node.
Iterate the descendants of a given node.
Fold the ancestors of a given node.
Fold the descendants of a given node.
Iterate all the in-edges of a given node.
Iterate all the out-edges of a given node.
Fold all the in-edges of a given node.
Fold all the out-edges of a given node.
Pretty print a given node.