tamarin-prover-utils-1.2.2: Utility library for the tamarin prover.

Copyright | (c) 20102012 Simon Meier
License | GPL v3 (see LICENSE)
Maintainer | Simon Meier <iridcode@gmail.com>
Safe Haskell | None
Language | Haskell98

Data.DAG.Simple

Contents

- Computing with binary relations
  - Cycles

Description

Simple vertice list based representation of DAGs and some common operations on it.

Synopsis

- type Relation a = [(a, a)]
- inverse :: Relation a -> Relation a
- image :: Eq a => a -> Relation a -> [a]
- reachableSet :: Ord a => [a] -> [(a, a)] -> Set a
- restrict :: (a -> Bool) -> Relation a -> Relation a
- dfsLoopBreakers :: Ord a => [(a, a)] -> [a]
- cyclic :: Ord a => [(a, a)] -> Bool
- toposort :: Ord a => [(a, a)] -> [a]

# Computing with binary relations

type Relation a = [(a, a)] #

A relation represented as a list of tuples.

inverse :: Relation a -> Relation a #

The inverse of a `Relation`.

image :: Eq a => a -> Relation a -> [a] #

The image of an element under a `Relation`.

reachableSet :: Ord a => [a] -> [(a, a)] -> Set a #

Compute the set of nodes reachable from the given set of nodes.

restrict :: (a -> Bool) -> Relation a -> Relation a #

Restrict a relation to elements satisfying a predicate.

## Cycles

dfsLoopBreakers :: Ord a => [(a, a)] -> [a] #

Compute a minimal set of loop-breakers using a greedy DFS strategy. A set of loop-breakers is a set of nodes such that removing them ensures the acyclicity of the relation. It is minimal, if no node can be removed from the set.

cyclic :: Ord a => [(a, a)] -> Bool #

Is the relation cyclic.

toposort :: Ord a => [(a, a)] -> [a] #

Produce a topological sorting of the given relation. If the relation is cyclic, then the result is at least some permutation of all elements of the given relation.