haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageHaskell2010

Prufer

Description

Prufer sequences

Functions to convert trees to Prufer sequences and vice versa

Sources:

Synopsis

Documentation

graphToSeq :: Graph -> [Vertex] Source #

Convert a bidirected Graph to a Prufer sequence. The graph must be a connected tree or empty. O(n).

treeToSeq :: Bounds -> Tree Vertex -> [Vertex] Source #

Convert a Tree to a Prufer sequence. The tree must be rooted at r. O(n).

seqToEdges :: Bounds -> [Vertex] -> [Edge] Source #

Convert a Prufer sequence to a list of edges, each edge present twice in its two orientations. The sequence must be valid. O(n).

seqToGraph :: Bounds -> [Vertex] -> Graph Source #

Convert a Prufer sequence to a bidirected Graph. The sequence must be valid. O(n).