nimnet/algorithms/simple_paths

Simple path algorithms

Enumerate all simple paths, check simple paths, count paths.

Procs

proc allSimplePathsSeq[N](g: DiGraph[N]; source, target: N; cutoff: int = -1): seq[
    seq[N]]
Return all simple paths from source to target as a sequence.
proc allSimplePathsSeq[N](g: Graph[N]; source, target: N; cutoff: int = -1): seq[
    seq[N]]
Return all simple paths from source to target as a sequence.
func isSimplePath[N](path: seq[N]): bool
Return true if path has no repeated nodes.

Iterators

iterator allSimplePaths[N](g: DiGraph[N]; source, target: N; cutoff: int = -1): seq[
    N]
Yield all simple paths from source to target in a directed graph.
iterator allSimplePaths[N](g: Graph[N]; source, target: N; cutoff: int = -1): seq[
    N]
Yield all simple paths from source to target in an undirected graph. If cutoff >= 0, only paths of length <= cutoff are returned.