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

Algebra.Graph.Relation.Reflexive

Contents

Description

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

Synopsis

# Data structure

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
 Ord a => Eq (ReflexiveRelation a) Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive Methods (Ord a, Num a) => Num (ReflexiveRelation a) Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive Methods Ord a => Ord (ReflexiveRelation a) Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive Methods (Ord a, Show a) => Show (ReflexiveRelation a) Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive MethodsshowList :: [ReflexiveRelation a] -> ShowS # Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive Methodsrnf :: ReflexiveRelation a -> () # Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive Ord a => Graph (ReflexiveRelation a) Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive Associated Typestype Vertex (ReflexiveRelation a) :: Type Source # Methods type Vertex (ReflexiveRelation a) Source # Instance detailsDefined in Algebra.Graph.Relation.Reflexive type Vertex (ReflexiveRelation a) = a

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

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