B2R2


Traversal Module

Functions and values

Function or value Description

consume visited g fn acc _arg2

Full Usage: consume visited g fn acc _arg2

Parameters:
Returns: 'c * Vertex<'a> list
visited : HashSet<VertexID>
g : DiGraph<'a, 'b>
fn : 'c -> Vertex<'a> -> 'c
acc : 'c
_arg2 : Vertex<'a> list
Returns: 'c * Vertex<'a> list

foldPostorder g roots fn acc

Full Usage: foldPostorder g roots fn acc

Parameters:
Returns: 'c

Fold vertices of the graph in a depth-first manner with the postorder traversal. The traversal starts from each vertex in roots.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
fn : 'c -> Vertex<'a> -> 'c
acc : 'c
Returns: 'c

foldPreorder g roots fn acc

Full Usage: foldPreorder g roots fn acc

Parameters:
Returns: 'c

Fold vertices of the graph in a depth-first manner with the preorder traversal.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
fn : 'c -> Vertex<'a> -> 'c
acc : 'c
Returns: 'c

foldPreorderExcept g roots excepts fn acc

Full Usage: foldPreorderExcept g roots excepts fn acc

Parameters:
    g : DiGraph<'c, 'd>
    roots : Vertex<'c> list
    excepts : 'e list
    fn : 'g -> Vertex<'c> -> 'g
    acc : 'g

Returns: 'g

Fold vertices, except them in the second list, of the graph in a depth-first manner with the preorder traversal.

g : DiGraph<'c, 'd>
roots : Vertex<'c> list
excepts : 'e list
fn : 'g -> Vertex<'c> -> 'g
acc : 'g
Returns: 'g

foldRevPostorder g roots fn acc

Full Usage: foldRevPostorder g roots fn acc

Parameters:
Returns: 'c

Fold vertices of the graph in a depth-first manner with the reverse postorder traversal. The traversal starts from each vertex in roots.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
fn : 'c -> Vertex<'a> -> 'c
acc : 'c
Returns: 'c

foldTopologically g roots fn acc

Full Usage: foldTopologically g roots fn acc

Parameters:
Returns: 'g

Topologically fold every vertex of the given graph. For every unreachable nodes, we accumulate vertices reachable from the node in a postorder fashion. The accumulated list becomes the reverse postordered vertices, which is essentially the same as a topologically sorted list of vertices. We then simply fold the accumulated list. The second parameter (root) is for providing root vertices in case there is no unreachable node, e.g., when there is a loop to the root node.

g : DiGraph<'e, 'f>
roots : Vertex<'e> list
fn : 'g -> Vertex<'e> -> 'g
acc : 'g
Returns: 'g

iterPostorder g roots fn

Full Usage: iterPostorder g roots fn

Parameters:

Iterate vertices of the graph in a depth-first manner with the postorder traversal. The traversal starts from each vertex in roots.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
fn : Vertex<'a> -> unit

iterPreorder g roots fn

Full Usage: iterPreorder g roots fn

Parameters:

Iterate vertices of the graph in a depth-first manner with the preorder traversal.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
fn : Vertex<'a> -> unit

iterPreorderExcept g roots excepts fn

Full Usage: iterPreorderExcept g roots excepts fn

Parameters:

Iterate vertices, except them in the second list, of the graph in a depth-first manner with the preorder traversal.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
excepts : 'c list
fn : Vertex<'a> -> unit

iterRevPostorder g roots fn

Full Usage: iterRevPostorder g roots fn

Parameters:

Iterate vertices of the graph in a depth-first manner with the reverse postorder traversal. The traversal starts from each vertex in roots.

g : DiGraph<'a, 'b>
roots : Vertex<'a> list
fn : Vertex<'a> -> unit