typerbole-0.0.0.5: A typeystems library with exaggerated claims

Safe HaskellNone
LanguageHaskell2010

Data.Graph.Inductive.Helper

Synopsis

Documentation

findRootPaths :: Graph gr => gr n e -> Context n e -> (Node, [[Node]]) Source #

findRootPathsBy :: Graph gr => (Context n e -> a) -> gr n e -> Context n e -> (a, [[a]]) Source #

treeRootStatefulBy Source #

Arguments

:: Graph gr 
=> (st -> Context n e -> (a, st))

The stateful fold function

-> st

The initial state

-> gr n e

The graph to traverse

-> Context n e

The initial context

-> Tree (a, st)

The resulting tree of values and states at each node.

cyclesOfGraph :: Graph gr => gr n l -> [[LNode n]] Source #

cyclicSubgraphs :: forall gr n e. (DynGraph gr, Ord n, Ord e) => gr n e -> [gr n e] Source #

Given a graph, generate a possibly empty list of subgraphs that are the it's cycles.

hasSome :: [a] -> Bool Source #

Returns true if a list has more than 1 element

hasSome' :: [Context n l] -> Bool Source #

Returns true if a list of contexts has more than one element or a loop in it's only element.

buildFromNodes :: (DynGraph gr, Foldable t) => t a -> gr a () Source #

Build a graph with no edges from a foldable container of node values.

topsortWithCycles :: (Graph gr, Ord a) => gr a b -> [Either [a] a] Source #

A version of topsort that returns cycles as groups rather than incorperating them into it's result arbitrarily.

It's result is a list of eithers, with Left values representing cycles and Right values as nodes not within a cycle, in an order similar to what is given by a regular topsort.

treeToPaths :: Tree a -> [[a]] Source #

Convert a tree into a list of all of it's paths.

edgeyTopsort :: Graph gr => gr n e -> Maybe [(n, e)] Source #

Build a topsort inclusive of outward edges. Nodes without outward edges are ignored.

If there are cycles in the graph, Nothing is returned.

unvalidatedEdgeyTopsort :: Graph gr => gr n e -> [(n, e)] Source #

edgeyTopsort but doesn't check for cycles first.