clash-lib-1.0.1: CAES Language for Synchronous Hardware - As a Library
Copyright(C) 2018 QBayLogic
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellSafe
LanguageHaskell2010

Clash.Util.Graph

Description

Collection of utilities

Synopsis

Documentation

topSort Source #

Arguments

:: [(Int, a)]

Nodes

-> [(Int, Int)]

Edges

-> Either String [a]

Error message or topologically sorted nodes

See: https://en.wikipedia.org/wiki/Topological_sorting. This function errors if edges mention nodes not mentioned in the node list or if the given graph contains cycles.

reverseTopSort Source #

Arguments

:: [(Int, a)]

Nodes

-> [(Int, Int)]

Edges

-> Either String [a]

Reversely, topologically sorted nodes

Same as `reverse (topSort nodes edges)` if alternative representations are considered the same. That is, topSort might produce multiple answers and still deliver on its promise of yielding a topologically sorted node list. Likewise, this function promises one of those lists in reverse, but not necessarily the reverse of topSort itself.