pangraph-0.1.1.5: A set of parsers for graph languages.

Safe HaskellNone
LanguageHaskell2010

Pangraph

Contents

Synopsis

Abstract Types

data Pangraph Source #

The Pangraph type is the core intermediate type between abstract representations of graphs.

data Edge Source #

Edges also reqiure [Attribute] and a tuple of Vertex passed as connections to be constructed with makeEdge

Instances

Eq Edge Source # 

Methods

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

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

Show Edge Source # 

Methods

showsPrec :: Int -> Edge -> ShowS #

show :: Edge -> String #

showList :: [Edge] -> ShowS #

data Vertex Source #

A Vertex holds [Attribute] and must have a unique VertexID to be constructed with makeVertex.

Instances

type Attribute = (Key, Value) Source #

The type alias for storage of fields.

type Key = ByteString Source #

The Key in the tuple that makes up Attribute.

type Value = ByteString Source #

The Value in the tuple that makes up Attribute.

type VertexID = ByteString Source #

A field that is Maybe internally is exposed for lookup.

type EdgeID = Int Source #

A type exposed for lookup in the resulting lists.

Constructors

makePangraph :: [Vertex] -> [Edge] -> Maybe Pangraph Source #

Takes lists of Vertex and Edge to produce 'Just Pangraph' if the graph is correctly formed.

makeEdge :: [Attribute] -> (Vertex, Vertex) -> Edge Source #

Edge constructor

makeVertex :: VertexID -> [Attribute] -> Vertex Source #

Vertex constructor

Pangraph Getters

edgeList :: Pangraph -> [Edge] Source #

Returns the [Edge] from a Pangraph instance

vertexList :: Pangraph -> [Vertex] Source #

Returns the [Vertex] from a Pangraph instance

lookupVertex :: VertexID -> Pangraph -> Maybe Vertex Source #

Lookup of the VertexID in a Pangraph. Complexity: O(log n)

lookupEdge :: EdgeID -> Pangraph -> Maybe Edge Source #

Lookup of the EdgeID in a Pangraph. Complexity: O(log n)

Getters on Vertex and Edge

edgeAttributes :: Edge -> [Attribute] Source #

Returns the [Attribute] of an Edge

vertexAttributes :: Vertex -> [Attribute] Source #

Returns the [Attribute] list of an Edge

edgeEndpoints :: Edge -> (Vertex, Vertex) Source #

Returns the endpoint of tupled Vertex of an Edge

edgeID :: Edge -> Maybe EdgeID Source #

Returns the EdgeID if it has one. Edges are given a new EdgeID when they are passed and retrived from a Pangraph