libgraph-1.14: Store and manipulate data in a graph.

Safe HaskellSafe
LanguageHaskell2010

Data.Graph.Libgraph

Synopsis

Documentation

data Graph vertex arc #

Constructors

Graph 

Fields

Instances

Generic (Graph vertex arc) # 

Associated Types

type Rep (Graph vertex arc) :: * -> * #

Methods

from :: Graph vertex arc -> Rep (Graph vertex arc) x #

to :: Rep (Graph vertex arc) x -> Graph vertex arc #

type Rep (Graph vertex arc) # 
type Rep (Graph vertex arc) = D1 * (MetaData "Graph" "Data.Graph.Libgraph.Core" "libgraph-1.14-AJy13LrUf4nKnHh8DlJeOm" False) (C1 * (MetaCons "Graph" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "root") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * vertex)) ((:*:) * (S1 * (MetaSel (Just Symbol "vertices") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * [vertex])) (S1 * (MetaSel (Just Symbol "arcs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * [Arc vertex arc])))))

data Arc vertex arc #

Constructors

Arc 

Fields

Instances

(Eq arc, Eq vertex) => Eq (Arc vertex arc) # 

Methods

(==) :: Arc vertex arc -> Arc vertex arc -> Bool #

(/=) :: Arc vertex arc -> Arc vertex arc -> Bool #

(Show arc, Show vertex) => Show (Arc vertex arc) # 

Methods

showsPrec :: Int -> Arc vertex arc -> ShowS #

show :: Arc vertex arc -> String #

showList :: [Arc vertex arc] -> ShowS #

Generic (Arc vertex arc) # 

Associated Types

type Rep (Arc vertex arc) :: * -> * #

Methods

from :: Arc vertex arc -> Rep (Arc vertex arc) x #

to :: Rep (Arc vertex arc) x -> Arc vertex arc #

type Rep (Arc vertex arc) # 
type Rep (Arc vertex arc) = D1 * (MetaData "Arc" "Data.Graph.Libgraph.Core" "libgraph-1.14-AJy13LrUf4nKnHh8DlJeOm" False) (C1 * (MetaCons "Arc" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "source") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * vertex)) ((:*:) * (S1 * (MetaSel (Just Symbol "target") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * vertex)) (S1 * (MetaSel (Just Symbol "arc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * arc)))))

(-->) :: vertex -> vertex -> SimpleArc vertex #

Create an arc between two vertices.

succs :: Eq vertex => Graph vertex arc -> vertex -> [vertex] #

Direct successors of a vertex.

preds :: Eq vertex => Graph vertex arc -> vertex -> [vertex] #

Direct predecessors of a vertex.

isSucc :: Eq vertex => Graph vertex arc -> vertex -> vertex -> Bool #

Is first vertex a successor of second?

isPred :: Eq vertex => Graph vertex arc -> vertex -> vertex -> Bool #

Is first vertex a predecessor of second?

mapGraph :: (a -> b) -> Graph a c -> Graph b c #

mapArcs :: (a -> b) -> Graph c a -> Graph c b #

data Dfs vertex arc #

Instances

(Eq vertex, Show vertex) => Show (Dfs vertex arc) # 

Methods

showsPrec :: Int -> Dfs vertex arc -> ShowS #

show :: Dfs vertex arc -> String #

showList :: [Dfs vertex arc] -> ShowS #

getDfs :: Eq vertex => Graph vertex arc -> Dfs vertex arc #

Walk graph in depth-first order and number the vertices.

getEdgetype :: (Eq vertex, Show vertex) => Dfs vertex arc -> Arc vertex arc -> EdgeType #

The EdgeType of an Arc.

getPreorder :: Dfs vertex arc -> [vertex] #

Get list of vertices in the order they were visited by the depth-first search.

getPostorder :: Dfs vertex arc -> [vertex] #

Get list of vertices in the order they were last visited by the depth-first search.

isAncestor :: (Eq vertex, Show vertex) => Dfs vertex arc -> vertex -> vertex -> Maybe Bool #

Is first vertex a (recursive) parent of second vertex? May fail when one of the vertices is unreachable from the root.

data Domsets vertex arc #

Instances

(Eq vertex, Show vertex) => Show (Domsets vertex arc) # 

Methods

showsPrec :: Int -> Domsets vertex arc -> ShowS #

show :: Domsets vertex arc -> String #

showList :: [Domsets vertex arc] -> ShowS #

getDomsets :: Eq vertex => Graph vertex arc -> Domsets vertex arc #

Compute dominator sets. N.B. currently a naive algorithm is implemented with time-complexity O(vertex^2).

getDominators :: Eq vertex => vertex -> Domsets vertex arc -> [vertex] #

Vertices dominating the vertex given as argument.

data CycleTree vertex #

Constructors

CycleTree vertex [CycleTree vertex] 
Reducible vertex [CycleTree vertex] 
Irreducible [CycleTree vertex] 

Instances

Show vertex => Show (CycleTree vertex) # 

Methods

showsPrec :: Int -> CycleTree vertex -> ShowS #

show :: CycleTree vertex -> String #

showList :: [CycleTree vertex] -> ShowS #

getCycles :: Ord vertex => CycleNest vertex -> CycleTree vertex #

getRedHeaders :: CycleNest vertex -> [vertex] #

Entry vertices of reducible cycles.

dagify :: (Ord v, Eq a, Show v) => ([v] -> v) -> Graph v a -> Graph v a #

findFaulty :: (Ord v, Eq a, Show v) => (v -> Judgement) -> ([v] -> v) -> Graph v a -> [v] #

findFaulty_dag :: (Ord v, Eq a, Show v) => (v -> Judgement) -> Graph v a -> [v] #

next_step :: Eq v => Graph v a -> (v -> Judgement) -> v #

next_daq :: Ord v => Graph v a -> (v -> Judgement) -> v #

data Judgement #

Instances

Eq Judgement # 
Ord Judgement # 
Show Judgement # 
Generic Judgement # 

Associated Types

type Rep Judgement :: * -> * #

type Rep Judgement # 
type Rep Judgement = D1 * (MetaData "Judgement" "Data.Graph.Libgraph.AlgoDebug" "libgraph-1.14-AJy13LrUf4nKnHh8DlJeOm" False) ((:+:) * ((:+:) * (C1 * (MetaCons "Right" PrefixI False) (U1 *)) (C1 * (MetaCons "Wrong" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "Unassessed" PrefixI False) (U1 *)) (C1 * (MetaCons "Assisted" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * [AssistedMessage])))))

showWith :: Eq vertex => Graph vertex arc -> (vertex -> (String, String)) -> (Arc vertex arc -> String) -> String #

Convert Graph to String with functions to show vertices and arcs.

display :: (Graph vertex arc -> String) -> Graph vertex arc -> IO () #

Invoke Graphviz and Imagemagick to display graph on screen.

collapse :: (Show v, Ord v, Eq a) => ([v] -> v) -> Graph v a -> Graph v a #

remove :: (Ord v, Show v) => Graph v a -> Graph v a #

treeDepth :: Ord v => Graph v a -> Int #

succCache :: Ord vertex => Graph vertex arc -> vertex -> [vertex] #

predCache :: Ord vertex => Graph vertex arc -> vertex -> [vertex] #