Algebra.Graph.Relation.Reflexive

algebraic-graphs-0.7: A library for algebraic graph construction and transformation

Copyright | (c) Andrey Mokhov 2016-2022
License | MIT (see the file LICENSE)
Maintainer | andrey.mokhov@gmail.com
Stability | experimental
Safe Haskell | None
Language | Haskell2010

Algebra.Graph.Relation.Reflexive

Contents

- Data structure

Description

An abstract implementation of reflexive binary relations. Use Algebra.Graph.Class for polymorphic construction and manipulation.

Synopsis

- data ReflexiveRelation a
- fromRelation :: Relation a -> ReflexiveRelation a
- toRelation :: Ord a => ReflexiveRelation a -> Relation a

# Data structure

data ReflexiveRelation a #

The `ReflexiveRelation` data type represents a reflexive binary relation over a set of elements. Reflexive relations satisfy all laws of the `Reflexive` type class and, in particular, the self-loop axiom:

    vertex x == vertex x * vertex x

The `Show` instance produces reflexively closed expressions:

    show (1     :: ReflexiveRelation Int) == "edge 1 1"
    show (1 * 2 :: ReflexiveRelation Int) == "edges [(1,1),(1,2),(2,2)]"

#### Instances

Instances details

Ord a => Graph (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Associated Types
type Vertex (ReflexiveRelation a) |
Instance details Defined in Algebra.Graph.Relation.Reflexive type Vertex (ReflexiveRelation a) = a
Methods empty :: ReflexiveRelation a # vertex :: Vertex (ReflexiveRelation a) -> ReflexiveRelation a # overlay :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a # connect :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a #
Ord a => Reflexive (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive
NFData a => NFData (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Methods rnf :: ReflexiveRelation a -> () #
IsString a => IsString (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Methods fromString :: String -> ReflexiveRelation a #
(Ord a, Num a) => Num (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Methods (+) :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a # (-) :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a # (*) :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a # negate :: ReflexiveRelation a -> ReflexiveRelation a # abs :: ReflexiveRelation a -> ReflexiveRelation a # signum :: ReflexiveRelation a -> ReflexiveRelation a # fromInteger :: Integer -> ReflexiveRelation a #
(Ord a, Show a) => Show (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Methods showsPrec :: Int -> ReflexiveRelation a -> ShowS # show :: ReflexiveRelation a -> String # showList :: [ReflexiveRelation a] -> ShowS #
Ord a => Eq (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Methods (==) :: ReflexiveRelation a -> ReflexiveRelation a -> Bool # (/=) :: ReflexiveRelation a -> ReflexiveRelation a -> Bool #
Ord a => Ord (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive Methods compare :: ReflexiveRelation a -> ReflexiveRelation a -> Ordering # (<) :: ReflexiveRelation a -> ReflexiveRelation a -> Bool # (<=) :: ReflexiveRelation a -> ReflexiveRelation a -> Bool # (>) :: ReflexiveRelation a -> ReflexiveRelation a -> Bool # (>=) :: ReflexiveRelation a -> ReflexiveRelation a -> Bool # max :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a # min :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a #
type Vertex (ReflexiveRelation a) # |
Instance details Defined in Algebra.Graph.Relation.Reflexive type Vertex (ReflexiveRelation a) = a

fromRelation :: Relation a -> ReflexiveRelation a #

Construct a reflexive relation from a `Relation`. Complexity: O(1) time.

toRelation :: Ord a => ReflexiveRelation a -> Relation a #

Extract the underlying relation. Complexity: O(n*log(m)) time.