hasbolt-extras-0.0.0.10: Extras for hasbolt library

Safe HaskellNone
LanguageHaskell2010

Database.Bolt.Extras.Graph

Synopsis

Documentation

data Graph n a b Source #

Graph contains vertices, that are parameterized by some type n, and relations, that parameterized by pair of type n. This pair represents vertices, that are connected with this relation.

Constructors

Graph 

Fields

Instances

(Show b, Show a, Show n) => Show (Graph n a b) Source # 

Methods

showsPrec :: Int -> Graph n a b -> ShowS #

show :: Graph n a b -> String #

showList :: [Graph n a b] -> ShowS #

emptyGraph :: Ord n => Graph n a b Source #

Creates empty graph.

addNode :: (Show n, Ord n) => n -> a -> Graph n a b -> Graph n a b Source #

Adds node to graph by it's name and node content. If graph already contains vertex with given name, error will be thrown.

addRelation :: (Show n, Ord n) => n -> n -> b -> Graph n a b -> Graph n a b Source #

Adds relation to graph by startName of vertex, endName of vertex, and rel with relation content. If graph already contains relation with given (startName, endName), error will be thrown.