cifl-math-library-1.1.1.0: Math libraries
Copyright(c) Esa Pulkkinen 2018
Maintaineresa.pulkkinen@iki.fi
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Math.Graph

Description

These exported modules implement graphs as specified in Lawvere, Rosebrugh: Sets for mathematics.

Compact representation of the graph is:

  • digraphs: left and right actions of a three-element non-trivial monoid on endomorphisms of the two-element set
  • graphs : left and right actions of a four-element non-trivial monoid on endomorphisms of the two-element set

The graph representation is based on just single set which contains both vertices and edges. This means we have operation, isVertexM, for determining whether an element of the set is a vertex or an edge.

For non-mathematicians, think of a database table with three or four fields, where fields are called

  • id
  • source
  • target
  • invert

The invert field is not present in a digraph.

The monoid structure provides basic properties of source and target actions.

source . target == source
target . source == target
source . source == source
target . target == target

Think of the actions in terms of state machines, from any element, we can always ask for source and target, but above equations mean that for vertices,

isVertex v => source v == v
isVertex v => target v == v
Synopsis

digraphs

operations for building graphs

labeled graphs

graph algorithms

transformations between graphs

string conversion for graphs

xml conversion for graphs

dot conversion for graphs

JSON conversion for graphs

rdf conversion for graphs

monoid for id,source,target,invert operations

interface for graph monad and arrows

arrow for inspecting graph data

monad for inspecting graph data

library for general actions of a monoid