-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A set of parsers for graph languages and conversions to -- graph libaries. -- -- A package allowing parsing of graph files into graph library -- datatypes. With aim the cope with large networks and provide -- translations between graph libraries. Like a pandoc but for graphs. -- This is my first library so any feedback and help is appreicated. For -- example use please see the homepage. @package pangraph @version 0.1.2 module Pangraph -- | The Pangraph type is the core intermediate type between -- abstract representations of graphs. data Pangraph -- | Edges also reqiure [Attribute] and a tuple of Vertex -- passed as connections to be constructed with makeEdge data Edge -- | A Vertex holds [Attribute] and must have a unique -- VertexID to be constructed with makeVertex. data Vertex -- | The type alias for storage of fields. type Attribute = (Key, Value) -- | The Key in the tuple that makes up Attribute. type Key = ByteString -- | The Value in the tuple that makes up Attribute. type Value = ByteString -- | A field that is Maybe internally is exposed for lookup. type VertexID = ByteString -- | A type exposed for lookup in the resulting lists. type EdgeID = Int -- | Takes lists of Vertex and Edge to produce 'Just -- Pangraph' if the graph is correctly formed. makePangraph :: [Vertex] -> [Edge] -> Maybe Pangraph -- | Edge constructor makeEdge :: [Attribute] -> (Vertex, Vertex) -> Edge -- | Vertex constructor makeVertex :: VertexID -> [Attribute] -> Vertex -- | Returns the [Edge] from a Pangraph instance edgeList :: Pangraph -> [Edge] -- | Returns the [Vertex] from a Pangraph instance vertexList :: Pangraph -> [Vertex] -- | Lookup of the VertexID in a Pangraph. Complexity: -- O(log n) lookupVertex :: VertexID -> Pangraph -> Maybe Vertex -- | Lookup of the EdgeID in a Pangraph. Complexity: O(log -- n) lookupEdge :: EdgeID -> Pangraph -> Maybe Edge -- | Returns the [Attribute] of an Edge edgeAttributes :: Edge -> [Attribute] -- | Returns the [Attribute] list of an Edge vertexAttributes :: Vertex -> [Attribute] -- | Returns the endpoint of tupled Vertex of an Edge edgeEndpoints :: Edge -> (Vertex, Vertex) -- | Returns the EdgeID if it has one. Edges are given a new -- EdgeID when they are passed and retrived from a Pangraph edgeID :: Edge -> Maybe EdgeID -- | Returns a VertexID vertexID :: Vertex -> VertexID instance GHC.Classes.Eq Pangraph.Pangraph instance GHC.Classes.Eq Pangraph.Edge instance GHC.Classes.Eq Pangraph.Vertex instance GHC.Show.Show Pangraph.Pangraph instance Algebra.Graph.Class.ToGraph Pangraph.Pangraph instance GHC.Show.Show Pangraph.Edge instance GHC.Show.Show Pangraph.Vertex module Pangraph.Containers -- | Transforms a Pangraph in a Graph. convert :: Pangraph -> (Graph, Vertex -> (Vertex, VertexID, [VertexID]), VertexID -> Maybe Vertex) module Pangraph.Examples.SampleGraph smallGraph :: Pangraph module Pangraph.Examples.ToContainersGraph main :: IO () module Pangraph.GraphML.Writer -- | Serialise a Pangraph into a GraphML file producing a -- ByteString. write :: Pangraph -> ByteString module Pangraph.Examples.Writing main :: IO () module Pangraph.Internal.XMLTemplate data Template graphMLTemplate :: Template hexmlToPangraph :: Template -> HexmlVertex -> Maybe Pangraph module Pangraph.GraphML.Parser -- | Returns Pangraph if it can be parsed from a raw GraphML file. parse :: ByteString -> Maybe Pangraph -- | Like parse except it throws an error on Nothing, which is when -- parsing fails. unsafeParse :: ByteString -> Pangraph module Pangraph.Examples.Reading main :: IO ()