hgraph-1.10.0.0: Tools for working on (di)graphs.
Safe HaskellSafe-Inferred
LanguageHaskell2010

HGraph.Directed

Synopsis

Documentation

class DirectedGraph t where Source #

Minimal complete definition

empty, vertices, arcs, linearizeVertices, isVertex

Methods

empty :: t a -> t a Source #

vertices :: t a -> [a] Source #

numVertices :: Integral b => t a -> b Source #

arcs :: t a -> [(a, a)] Source #

numArcs :: Integral b => t a -> b Source #

linearizeVertices :: t a -> (t Int, [(Int, a)]) Source #

isVertex :: t a -> a -> Bool Source #

Instances

Instances details
DirectedGraph Digraph Source # 
Instance details

Defined in HGraph.Directed.AdjacencyMap

Methods

empty :: Digraph a -> Digraph a Source #

vertices :: Digraph a -> [a] Source #

numVertices :: Integral b => Digraph a -> b Source #

arcs :: Digraph a -> [(a, a)] Source #

numArcs :: Integral b => Digraph a -> b Source #

linearizeVertices :: Digraph a -> (Digraph Int, [(Int, a)]) Source #

isVertex :: Digraph a -> a -> Bool Source #

class Adjacency t where Source #

Minimal complete definition

outneighbors, inneighbors, arcExists

Methods

outneighbors :: t a -> a -> [a] Source #

inneighbors :: t a -> a -> [a] Source #

outdegree :: Integral b => t a -> a -> b Source #

indegree :: Integral b => t a -> a -> b Source #

incomingArcs :: t a -> a -> [(a, a)] Source #

outgoingArcs :: t a -> a -> [(a, a)] Source #

arcExists :: t a -> (a, a) -> Bool Source #

metaBfs :: Ord a => t a -> a -> ([a] -> [a]) -> ([a] -> [a]) -> [a] Source #

Instances

Instances details
Adjacency Digraph Source # 
Instance details

Defined in HGraph.Directed.AdjacencyMap

Methods

outneighbors :: Digraph a -> a -> [a] Source #

inneighbors :: Digraph a -> a -> [a] Source #

outdegree :: Integral b => Digraph a -> a -> b Source #

indegree :: Integral b => Digraph a -> a -> b Source #

incomingArcs :: Digraph a -> a -> [(a, a)] Source #

outgoingArcs :: Digraph a -> a -> [(a, a)] Source #

arcExists :: Digraph a -> (a, a) -> Bool Source #

metaBfs :: Ord a => Digraph a -> a -> ([a] -> [a]) -> ([a] -> [a]) -> [a] Source #

class Mutable t where Source #

Methods

addVertex :: a -> t a -> t a Source #

removeVertex :: a -> t a -> t a Source #

addArc :: (a, a) -> t a -> t a Source #

removeArc :: (a, a) -> t a -> t a Source #

Instances

Instances details
Mutable Digraph Source # 
Instance details

Defined in HGraph.Directed.AdjacencyMap

Methods

addVertex :: a -> Digraph a -> Digraph a Source #

removeVertex :: a -> Digraph a -> Digraph a Source #

addArc :: (a, a) -> Digraph a -> Digraph a Source #

removeArc :: (a, a) -> Digraph a -> Digraph a Source #

subgraphAround :: (DirectedGraph t, Adjacency t, Mutable t) => Int -> t a -> a -> t a Source #

renameVertices :: (DirectedGraph t, Mutable t, Ord a) => Map a b -> t b -> t a -> t b Source #

inducedSubgraph :: (Mutable t, DirectedGraph t, Ord a) => t a -> Set a -> t a Source #

lineDigraphI :: (DirectedGraph t, Adjacency t, Mutable t) => t Int -> (t Int, [(Int, (Int, Int))]) Source #

The line digraph of a digraph d is the digraph `(V', A')`, where V' is the set of arcs of d there is an arc (a,b) if the head of b in d is the same as the tail of a in d.

isIsomorphicTo :: (Adjacency t, Adjacency t, DirectedGraph t, DirectedGraph t) => t a -> t a -> Bool Source #

Find an isomorphism from d0 to d1, if it exists.

isIsomorphicToI :: forall {t} {t} {a} {k}. (Adjacency t, Adjacency t, DirectedGraph t, DirectedGraph t, Ord k, Ord a) => t k -> t a -> Bool Source #

splitVertices :: (Mutable t, DirectedGraph t, Num a) => t a -> t a Source #

Split each vertex v of the digraph into two vertices v_in and v_out. All incoming arcs of v become incoming arcs of v_in, all outgoing arcs from v become outgoing arcs from v_out and there is an arc `(v_in, v_out)`.

This operation is useful when obtaining a vertex variant of arc-based algorithms like maximum flow.

union :: (Mutable t, DirectedGraph t) => t a -> t a -> t a Source #