-- 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.2.1 -- | See Pangraph for the type which provides a guaranteed -- well-formed graph once constructed. The rest of the modules provides -- constructors and getters on this type. 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 type MalformedEdge = (Edge, (Maybe VertexID, Maybe VertexID)) -- | Takes lists of Vertex and Edge to produce 'Just -- Pangraph' if the graph is correctly formed. makePangraph :: [Vertex] -> [Edge] -> Maybe Pangraph -- | Edge constructor makeEdge :: (VertexID, VertexID) -> [Attribute] -> 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 -> (VertexID, VertexID) -- | 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.Vertex instance GHC.Classes.Eq Pangraph.Edge instance GHC.Show.Show Pangraph.Pangraph instance Algebra.Graph.ToGraph.ToGraph Pangraph.Pangraph instance GHC.Show.Show Pangraph.Vertex instance GHC.Show.Show Pangraph.Edge module Pangraph.Containers -- | Transforms a Pangraph into a Graph. convert :: Pangraph -> (Graph, Vertex -> (Vertex, VertexID, [VertexID]), VertexID -> Maybe Vertex) module Pangraph.Examples.SampleGraph smallGraph :: Pangraph -- | AST for gml (Graph Modelling Language) files. The specification of the -- gml format can be found at: -- http://www.fim.uni-passau.de/fileadmin/files/lehrstuhl/brandenburg/projekte/gml/gml-technical-report.pdf. module Pangraph.Gml.Ast -- | Type of a AST node. k is the type that is used to represent -- strings. data Gml k -- | Integer value Integer :: Integer -> Gml k -- | Floating point value Float :: Double -> Gml k -- | String value String :: k -> Gml k -- | Object value. A gml object is a list of named values. The names of the -- values are not necessarily unique! Object :: [(k, Gml k)] -> Gml k -- | Looks up a value in the given gml object. Produces Nothing when -- the given value is not a gml object or the object doesn't contain the -- a value with the given name. If a object contains multiple values with -- the same name one the values is returned. lookupValue :: Eq k => Gml k -> k -> Maybe (Gml k) -- | If the given gml value is a integer produces the integer value. integerValue :: Gml k -> Maybe Integer -- | If the given gml value is a double value produces the float value. floatValue :: Gml k -> Maybe Double -- | If the given gml value is a string produces the string value. stringValue :: Gml k -> Maybe k -- | If the given gml value is an object produces the list of values that -- the object contains. objectValues :: Gml k -> Maybe [(k, Gml k)] -- | Maps all strings in the gml ast. mapStrings :: (a -> b) -> Gml a -> Gml b instance GHC.Classes.Ord k => GHC.Classes.Ord (Pangraph.Gml.Ast.Gml k) instance GHC.Classes.Eq k => GHC.Classes.Eq (Pangraph.Gml.Ast.Gml k) instance GHC.Show.Show k => GHC.Show.Show (Pangraph.Gml.Ast.Gml k) -- | Functions for parseing gml (Graphical Modelling Language) files. A gml -- specification can be found at: -- http://www.fim.uni-passau.de/fileadmin/files/lehrstuhl/brandenburg/projekte/gml/gml-technical-report.pdf. -- -- This follows the specification except for two cases: -- --