algebraic-graphs-0.7: A library for algebraic graph construction and transformation
Copyright(c) Andrey Mokhov 2016-2022
LicenseMIT (see the file LICENSE)
Maintainerandrey.mokhov@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Algebra.Graph.Labelled.Example.Network

Description

Alga is a library for algebraic construction and manipulation of graphs in Haskell. See this paper for the motivation behind the library, the underlying theory, and implementation details.

This module contains a simple example of using edge-labelled graphs defined in the module Algebra.Graph.Labelled for working with networks, i.e. graphs whose edges are labelled with distances.

Synopsis

Documentation

data City Source #

Our example networks have cities as vertices.

Instances

Instances details
Bounded City Source # 
Instance details

Defined in Algebra.Graph.Labelled.Example.Network

Enum City Source # 
Instance details

Defined in Algebra.Graph.Labelled.Example.Network

Methods

succ :: City -> City #

pred :: City -> City #

toEnum :: Int -> City #

fromEnum :: City -> Int #

enumFrom :: City -> [City] #

enumFromThen :: City -> City -> [City] #

enumFromTo :: City -> City -> [City] #

enumFromThenTo :: City -> City -> City -> [City] #

Eq City Source # 
Instance details

Defined in Algebra.Graph.Labelled.Example.Network

Methods

(==) :: City -> City -> Bool #

(/=) :: City -> City -> Bool #

Ord City Source # 
Instance details

Defined in Algebra.Graph.Labelled.Example.Network

Methods

compare :: City -> City -> Ordering #

(<) :: City -> City -> Bool #

(<=) :: City -> City -> Bool #

(>) :: City -> City -> Bool #

(>=) :: City -> City -> Bool #

max :: City -> City -> City #

min :: City -> City -> City #

Show City Source # 
Instance details

Defined in Algebra.Graph.Labelled.Example.Network

Methods

showsPrec :: Int -> City -> ShowS #

show :: City -> String #

showList :: [City] -> ShowS #

type JourneyTime = Int Source #

For simplicity we measure journey times in integer number of minutes.

eastCoast :: Network JourneyTime City Source #

A part of the EastCoast train network between Aberdeen and London.

eastCoast = overlays [ Aberdeen  -<150>- Edinburgh
                     , Edinburgh -< 90>- Newcastle
                     , Newcastle -<170>- London ]

scotRail :: Network JourneyTime City Source #

A part of the ScotRail train network between Aberdeen and Glasgow.

scotRail = overlays [ Aberdeen  -<140>- Edinburgh
                    , Edinburgh -< 50>- Glasgow
                    , Edinburgh -< 70>- Glasgow ]

network :: Network JourneyTime City Source #

An example train network.

network = overlay scotRail eastCoast