algebraic-graphs-0.6.1: 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

Description

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

Synopsis

Data structure

data ReflexiveRelation a Source #

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 => Eq ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

( Ord a, Num a) => Num ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

Ord a => Ord ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

( Ord a, Show a) => Show ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

IsString a => IsString ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

NFData a => NFData ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

Ord a => Reflexive ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

Ord a => Graph ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

type Vertex ( ReflexiveRelation a) Source #
Instance details

Defined in Algebra.Graph.Relation.Reflexive

fromRelation :: Relation a -> ReflexiveRelation a Source #

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

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

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