Logo FS-Skia-UI

Graph Module

Functions and values

Function or value Description

detectCycle nodes edges

Full Usage: detectCycle nodes edges

Parameters:
Returns: NodeId list option

3-colour DFS cycle detection. Returns one cycle witness (a list of node ids with the closing id repeated, e.g. `[a; b; c; a]`) if any cycle is present, otherwise `None`.

nodes : NodeId list
edges : Edge list
Returns: NodeId list option

topoSort nodes edges

Full Usage: topoSort nodes edges

Parameters:
Returns: Result<NodeId list, NodeId list>

Kahn topological sort with a deterministic ascending-`NodeId` tie-break. `Ok order` lists every node in a valid run order; `Error remaining` lists the nodes that could not be ordered because they participate in (or depend on) a cycle. Edges that reference unknown nodes are ignored.

nodes : NodeId list
edges : Edge list
Returns: Result<NodeId list, NodeId list>

Type something to start searching.