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

Copyright(c) 20102012 Simon Meier
LicenseGPL v3 (see LICENSE)
MaintainerSimon Meier <iridcode@gmail.com>
Safe HaskellNone
LanguageHaskell98

Data.DAG.Simple

Contents

Description

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

Synopsis

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.