|
| Data.Relation.SetOfPairs | | Portability | portable | | Stability | experimental | | Maintainer | joost.visser@di.uminho.pt |
|
|
|
|
|
| Description |
| An implementation of relations as sets of pairs.
|
|
| Synopsis |
|
| type Rel a b = Set (a, b) | | | emptyRel :: Rel a b | | | mkRel :: (Ord a, Ord b) => [(a, b)] -> Rel a b | | | identityRel :: Ord a => Set a -> Rel a a | | | totalRel :: Ord a => Set a -> Rel a a | | | chainRel :: (Enum n, Num n, Ord n) => n -> Rel n n | | | dom :: Ord a => Rel a b -> Set a | | | rng :: Ord b => Rel a b -> Set b | | | ent :: Ord a => Rel a a -> Set a | | | pairs :: (Ord a, Ord b) => Rel a b -> [(a, b)] | | | inv :: (Ord a, Ord b) => Rel a b -> Rel b a | | | comp :: (Ord a, Eq b, Ord c) => Rel b c -> Rel a b -> Rel a c | | | reflClose :: Ord a => Rel a a -> Rel a a | | | symmClose :: Ord a => Rel a a -> Rel a a | | | transClose :: Ord a => Rel a a -> Rel a a | | | reflTransClose :: Ord a => Rel a a -> Rel a a | | | equiv :: Ord b => Rel b b -> Rel b b | | | project :: (Ord a, Ord b) => Set a -> Rel a b -> Rel a b | | | projectBackward :: (Ord a, Ord b) => Set b -> Rel a b -> Rel a b | | | slice :: Ord a => Set a -> Rel a a -> Rel a a | | | sliceUntil :: Ord a => Set a -> Set a -> Rel a a -> Rel a a | | | sliceBackward :: Ord a => Set a -> Rel a a -> Rel a a | | | chop :: Ord a => Set a -> Set a -> Rel a a -> Rel a a |
|
|
|
| Representation |
|
| type Rel a b = Set (a, b) |
| Type of relations |
|
| Building relations |
|
| emptyRel :: Rel a b |
| Build an empty relation. |
|
| mkRel :: (Ord a, Ord b) => [(a, b)] -> Rel a b |
| Build a relation from a list of pairs. |
|
| identityRel :: Ord a => Set a -> Rel a a |
| Build identity relation, which contains an edge from each node to itself. |
|
| totalRel :: Ord a => Set a -> Rel a a |
| Build total relation, which contains an edge from each node to
each other node and to itself. |
|
| chainRel :: (Enum n, Num n, Ord n) => n -> Rel n n |
| Build a chain relation of given number of numerals. |
|
| Basic operations |
|
| dom :: Ord a => Rel a b -> Set a |
| Obtain the domain of a relation |
|
| rng :: Ord b => Rel a b -> Set b |
| Obtain the range of a relation |
|
| ent :: Ord a => Rel a a -> Set a |
| Obtain all entities in a relation (union of domain and range) |
|
| pairs :: (Ord a, Ord b) => Rel a b -> [(a, b)] |
| Convert relation to a list of pairs. |
|
| inv :: (Ord a, Ord b) => Rel a b -> Rel b a |
| Take the inverse of a relation |
|
| comp :: (Ord a, Eq b, Ord c) => Rel b c -> Rel a b -> Rel a c |
| Compose two relations |
|
| Closures |
|
| reflClose :: Ord a => Rel a a -> Rel a a |
| Compute the reflective closure |
|
| symmClose :: Ord a => Rel a a -> Rel a a |
| Compute the symmetric closure |
|
| transClose :: Ord a => Rel a a -> Rel a a |
| Compute the transitive closure |
|
| reflTransClose :: Ord a => Rel a a -> Rel a a |
| Compute the reflexive, transitive closure |
|
| equiv :: Ord b => Rel b b -> Rel b b |
| Compute the reflexive, transitive, symmetric closure, i.e. the
induced equivalence relation. |
|
| Selections (project, slice, chop) |
|
| project :: (Ord a, Ord b) => Set a -> Rel a b -> Rel a b |
| Projection of set through relation |
|
| projectBackward :: (Ord a, Ord b) => Set b -> Rel a b -> Rel a b |
| Projection of set backward through relation |
|
| slice :: Ord a => Set a -> Rel a a -> Rel a a |
| Compute forward slice starting from seeds. |
|
| sliceUntil :: Ord a => Set a -> Set a -> Rel a a -> Rel a a |
| Compute forward slice starting from seeds, stopping at stoppers. |
|
| sliceBackward :: Ord a => Set a -> Rel a a -> Rel a a |
| Compute backward slice starting from seeds. |
|
| chop :: Ord a => Set a -> Set a -> Rel a a -> Rel a a |
| Compute chop between seeds and sinks. |
|
| Produced by Haddock version 0.6 |