fgl-5.5.1.0: Martin Erwig's Functional Graph Library

Safe Haskell Safe-Inferred Haskell98

Data.Graph.Inductive.Basic

Description

Basic Graph Algorithms

Synopsis

Graph Operations

grev :: DynGraph gr => gr a b -> gr a b Source

Reverse the direction of all edges.

undir :: (Eq b, DynGraph gr) => gr a b -> gr a b Source

Make the graph undirected, i.e. for every edge from A to B, there exists an edge from B to A.

unlab :: DynGraph gr => gr a b -> gr () () Source

Remove all labels.

gsel :: Graph gr => (Context a b -> Bool) -> gr a b -> [Context a b] Source

Return all `Context`s for which the given function returns `True`.

Arguments

 :: Graph gr => (Context a b -> [Node]) direction of fold -> (Context a b -> c -> d) depth aggregation -> (Maybe d -> c -> c, c) breadth/level aggregation -> [Node] -> gr a b -> c

Directed graph fold.

Filter Operations

efilter :: DynGraph gr => (LEdge b -> Bool) -> gr a b -> gr a b Source

Filter based on edge property.

elfilter :: DynGraph gr => (b -> Bool) -> gr a b -> gr a b Source

Filter based on edge label property.

Predicates and Classifications

hasLoop :: Graph gr => gr a b -> Bool Source

`True` if the graph has any edges of the form (A, A).

isSimple :: Graph gr => gr a b -> Bool Source

The inverse of `hasLoop`.

Tree Operations

postorder :: Tree a -> [a] Source

Flatten a `Tree`, returning the elements in post-order.

postorderF :: [Tree a] -> [a] Source

Flatten multiple `Tree`s in post-order.

preorder :: Tree a -> [a] Source

Flatten a `Tree`, returning the elements in pre-order. Equivalent to `flatten` in `Tree`.

preorderF :: [Tree a] -> [a] Source

Flatten multiple `Tree`s in pre-order.