Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- data DGraph v e
- insertArc :: (Hashable v, Eq v) => Arc v e -> DGraph v e -> DGraph v e
- insertArcs :: (Hashable v, Eq v) => [Arc v e] -> DGraph v e -> DGraph v e
- removeArc :: (Hashable v, Eq v) => Arc v e -> DGraph v e -> DGraph v e
- removeArcs :: (Hashable v, Eq v) => [Arc v e] -> DGraph v e -> DGraph v e
- removeArcAndVertices :: (Hashable v, Eq v) => Arc v e -> DGraph v e -> DGraph v e
- arcs :: forall v e. (Hashable v, Eq v) => DGraph v e -> [Arc v e]
- containsArc :: (Hashable v, Eq v) => DGraph v e -> Arc v e -> Bool
- inboundingArcs :: (Hashable v, Eq v) => DGraph v e -> v -> [Arc v e]
- outboundingArcs :: (Hashable v, Eq v) => DGraph v e -> v -> [Arc v e]
- incidentArcs :: (Hashable v, Eq v) => DGraph v e -> v -> [Arc v e]
- vertexIndegree :: (Hashable v, Eq v) => DGraph v e -> v -> Int
- vertexOutdegree :: (Hashable v, Eq v) => DGraph v e -> v -> Int
- indegrees :: (Hashable v, Eq v) => DGraph v e -> [Int]
- outdegrees :: (Hashable v, Eq v) => DGraph v e -> [Int]
- isSymmetric :: DGraph v e -> Bool
- isOriented :: DGraph v e -> Bool
- isBalanced :: (Hashable v, Eq v) => DGraph v e -> Bool
- isRegular :: DGraph v e -> Bool
- isSource :: (Hashable v, Eq v) => DGraph v e -> v -> Bool
- isSink :: (Hashable v, Eq v) => DGraph v e -> v -> Bool
- isInternal :: (Hashable v, Eq v) => DGraph v e -> v -> Bool
- transpose :: (Hashable v, Eq v) => DGraph v e -> DGraph v e
- toUndirected :: (Hashable v, Eq v) => DGraph v e -> UGraph v e
- toArcsList :: (Hashable v, Eq v) => DGraph v e -> [Arc v e]
- fromArcsList :: (Hashable v, Eq v) => [Arc v e] -> DGraph v e
- prettyPrint :: (Hashable v, Eq v, Show v, Show e) => DGraph v e -> String

# DGraph data type

Directed Graph of Vertices in *v* and Arcs with attributes in *e*

Graph DGraph Source # | |

(Hashable v, Eq v) => Functor (DGraph v) Source # | |

(Hashable v, Eq v) => Foldable (DGraph v) Source # | |

(Eq e, Eq v) => Eq (DGraph v e) Source # | |

(Hashable v, Eq v, Read v, Read e) => Read (DGraph v e) Source # | |

(Hashable v, Eq v, Show v, Show e) => Show (DGraph v e) Source # | |

Generic (DGraph v e) Source # | |

(Hashable v, Eq v) => Semigroup (DGraph v e) Source # | |

(Hashable v, Eq v) => Monoid (DGraph v e) Source # | |

(Arbitrary v, Arbitrary e, Hashable v, Num v, Ord v) => Arbitrary (DGraph v e) Source # | |

(NFData v, NFData e) => NFData (DGraph v e) Source # | |

type Rep (DGraph v e) Source # | |

# Functions on DGraph

containsArc :: (Hashable v, Eq v) => DGraph v e -> Arc v e -> Bool Source #

Tell if a directed `Arc`

exists in the graph

inboundingArcs :: (Hashable v, Eq v) => DGraph v e -> v -> [Arc v e] Source #

Retrieve the inbounding `Arc`

s of a Vertex

outboundingArcs :: (Hashable v, Eq v) => DGraph v e -> v -> [Arc v e] Source #

Retrieve the outbounding `Arc`

s of a Vertex

incidentArcs :: (Hashable v, Eq v) => DGraph v e -> v -> [Arc v e] Source #

Retrieve the incident `Arc`

s of a Vertex

The `incident`

arcs of a vertex are all the inbounding and outbounding arcs
of the vertex

vertexIndegree :: (Hashable v, Eq v) => DGraph v e -> v -> Int Source #

Indegree of a vertex

The `indegree`

of a vertex is the number of inbounding `Arc`

s to a vertex

vertexOutdegree :: (Hashable v, Eq v) => DGraph v e -> v -> Int Source #

Outdegree of a vertex

The `outdegree`

of a vertex is the number of outbounding `Arc`

s from a vertex

indegrees :: (Hashable v, Eq v) => DGraph v e -> [Int] Source #

Indegrees of all the vertices in a `DGraph`

outdegrees :: (Hashable v, Eq v) => DGraph v e -> [Int] Source #

Outdegree of all the vertices in a `DGraph`

## Query graph properties and characteristics

isSymmetric :: DGraph v e -> Bool Source #

isOriented :: DGraph v e -> Bool Source #

Tell if a `DGraph`

is oriented

A directed graph is `oriented`

if there are none bi-directed `Arc`

s

Note: This is *not* the opposite of `isSymmetric`

isBalanced :: (Hashable v, Eq v) => DGraph v e -> Bool Source #

Tell if a `DGraph`

is balanced

A directed graph is `balanced`

when its `indegree = outdegree`

isRegular :: DGraph v e -> Bool Source #

Tell if a `DGraph`

is regular

A directed graph is `regular`

when all of its vertices have the same number
of adjacent vertices *AND* when the `indegree`

and `outdegree`

of each vertex
are equal to each other.

isSource :: (Hashable v, Eq v) => DGraph v e -> v -> Bool Source #

Tell if a vertex is a source

A vertex is a `source`

when its `indegree = 0`

isSink :: (Hashable v, Eq v) => DGraph v e -> v -> Bool Source #

Tell if a vertex is a sink

A vertex is a `sink`

when its `outdegree = 0`

isInternal :: (Hashable v, Eq v) => DGraph v e -> v -> Bool Source #

Tell if a vertex is internal

A vertex is `internal`

when its neither a `source`

nor a `sink`

## Transformations

transpose :: (Hashable v, Eq v) => DGraph v e -> DGraph v e Source #

Get the transpose of a `DGraph`

The `transpose`

of a directed graph is another directed graph where all of
its arcs are reversed

# List conversions

toArcsList :: (Hashable v, Eq v) => DGraph v e -> [Arc v e] Source #

Convert a `DGraph`

to a list of `Arc`

s discarding isolated vertices

Note that because `toArcsList`

discards isolated vertices:

fromArcsList . toArcsList /= id