uni-graphs-2.2.1.2: Graphs
Safe HaskellNone
LanguageHaskell2010

Graphs.Graph

Description

Graph defines the Graph class, which defines the basic things a graph must do. Peculiarities: (1) Graphs are directed with labelled nodes and arcs. These nodes and arcs have types. (2) The nodes and arcs are identified by values of type Node and Arc. These values are essentially strings. The strings are provided by the user; there is no mechanism for generating new unique strings. (This is because this is easy in the applications I have in mind.) (3) A necessary feature of these graphs is that it is supposed to be easy generate copies, both on the same system and on others.

Documentation

class Graph graph where Source #

Methods

getNodes :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [Node] Source #

getArcs :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [Arc] Source #

getNodeTypes :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [NodeType] Source #

getArcTypes :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [ArcType] Source #

getArcsOut :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO [Arc] Source #

getArcsIn :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO [Arc] Source #

getNodeLabel :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO nodeLabel Source #

getNodeType :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO NodeType Source #

getNodeTypeLabel :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> NodeType -> IO nodeTypeLabel Source #

getSource :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO Node Source #

getTarget :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO Node Source #

getArcLabel :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO arcLabel Source #

getArcType :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO ArcType Source #

getArcTypeLabel :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> ArcType -> IO arcTypeLabel Source #

shareGraph :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> GraphConnection nodeLabel nodeTypeLabel arcLabel arcTypeLabel Source #

newGraph :: GraphConnection nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO (graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source #

newNodeType :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> nodeTypeLabel -> IO NodeType Source #

newNode :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> NodeType -> nodeLabel -> IO Node Source #

newArcType :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> arcTypeLabel -> IO ArcType Source #

newArc :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> ArcType -> arcLabel -> Node -> Node -> IO Arc Source #

update :: graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO () Source #

newEmptyGraph :: IO (graph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source #

Instances

Instances details
Graph SimpleGraph Source # 
Instance details

Defined in Graphs.SimpleGraph

Methods

getNodes :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [Node] Source #

getArcs :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [Arc] Source #

getNodeTypes :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [NodeType] Source #

getArcTypes :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO [ArcType] Source #

getArcsOut :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO [Arc] Source #

getArcsIn :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO [Arc] Source #

getNodeLabel :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO nodeLabel Source #

getNodeType :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Node -> IO NodeType Source #

getNodeTypeLabel :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> NodeType -> IO nodeTypeLabel Source #

getSource :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO Node Source #

getTarget :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO Node Source #

getArcLabel :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO arcLabel Source #

getArcType :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Arc -> IO ArcType Source #

getArcTypeLabel :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> ArcType -> IO arcTypeLabel Source #

shareGraph :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> GraphConnection nodeLabel nodeTypeLabel arcLabel arcTypeLabel Source #

newGraph :: GraphConnection nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO (SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source #

newNodeType :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> nodeTypeLabel -> IO NodeType Source #

newNode :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> NodeType -> nodeLabel -> IO Node Source #

newArcType :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> arcTypeLabel -> IO ArcType Source #

newArc :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> ArcType -> arcLabel -> Node -> Node -> IO Arc Source #

update :: SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO () Source #

newEmptyGraph :: IO (SimpleGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source #

data Node Source #

Instances

Instances details
Eq Node Source # 
Instance details

Defined in Graphs.Graph

Methods

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

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

Ord Node Source # 
Instance details

Defined in Graphs.Graph

Methods

compare :: Node -> Node -> Ordering #

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

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

(>) :: Node -> Node -> Bool #

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

max :: Node -> Node -> Node #

min :: Node -> Node -> Node #

Read Node Source # 
Instance details

Defined in Graphs.Graph

Show Node Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> Node -> ShowS #

show :: Node -> String #

showList :: [Node] -> ShowS #

StringClass Node Source # 
Instance details

Defined in Graphs.Graph

data Arc Source #

Instances

Instances details
Eq Arc Source # 
Instance details

Defined in Graphs.Graph

Methods

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

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

Ord Arc Source # 
Instance details

Defined in Graphs.Graph

Methods

compare :: Arc -> Arc -> Ordering #

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

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

(>) :: Arc -> Arc -> Bool #

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

max :: Arc -> Arc -> Arc #

min :: Arc -> Arc -> Arc #

Read Arc Source # 
Instance details

Defined in Graphs.Graph

Show Arc Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> Arc -> ShowS #

show :: Arc -> String #

showList :: [Arc] -> ShowS #

StringClass Arc Source # 
Instance details

Defined in Graphs.Graph

data NodeType Source #

Instances

Instances details
Eq NodeType Source # 
Instance details

Defined in Graphs.Graph

Ord NodeType Source # 
Instance details

Defined in Graphs.Graph

Read NodeType Source # 
Instance details

Defined in Graphs.Graph

Show NodeType Source # 
Instance details

Defined in Graphs.Graph

StringClass NodeType Source # 
Instance details

Defined in Graphs.Graph

data ArcType Source #

Instances

Instances details
Eq ArcType Source # 
Instance details

Defined in Graphs.Graph

Methods

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

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

Ord ArcType Source # 
Instance details

Defined in Graphs.Graph

Read ArcType Source # 
Instance details

Defined in Graphs.Graph

Show ArcType Source # 
Instance details

Defined in Graphs.Graph

StringClass ArcType Source # 
Instance details

Defined in Graphs.Graph

data Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel Source #

Constructors

NewNodeType NodeType nodeTypeLabel 
SetNodeTypeLabel NodeType nodeTypeLabel 
NewNode Node NodeType nodeLabel 
DeleteNode Node 
SetNodeLabel Node nodeLabel 
SetNodeType Node NodeType 
NewArcType ArcType arcTypeLabel 
SetArcTypeLabel ArcType arcTypeLabel 
NewArc Arc ArcType arcLabel Node Node 
DeleteArc Arc 
SetArcLabel Arc arcLabel 
SetArcType Arc ArcType 
MultiUpdate [Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel] 

Instances

Instances details
Show (PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel)) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> ShowS #

show :: PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> String #

showList :: [PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel)] -> ShowS #

(Read nodeTypeLabel, Read nodeLabel, Read arcTypeLabel, Read arcLabel) => Read (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source # 
Instance details

Defined in Graphs.Graph

Methods

readsPrec :: Int -> ReadS (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) #

readList :: ReadS [Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel] #

readPrec :: ReadPrec (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) #

readListPrec :: ReadPrec [Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel] #

(Show nodeTypeLabel, Show nodeLabel, Show arcTypeLabel, Show arcLabel) => Show (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> ShowS #

show :: Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> String #

showList :: [Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel] -> ShowS #

data CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel Source #

Constructors

CannedGraph 

Fields

  • updates :: [Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel]
     

Instances

Instances details
Show (PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel)) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> ShowS #

show :: PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> String #

showList :: [PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel)] -> ShowS #

(Read nodeTypeLabel, Read nodeLabel, Read arcTypeLabel, Read arcLabel) => Read (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source # 
Instance details

Defined in Graphs.Graph

Methods

readsPrec :: Int -> ReadS (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) #

readList :: ReadS [CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel] #

readPrec :: ReadPrec (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) #

readListPrec :: ReadPrec [CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel] #

(Show nodeTypeLabel, Show nodeLabel, Show arcTypeLabel, Show arcLabel) => Show (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> ShowS #

show :: CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> String #

showList :: [CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel] -> ShowS #

type GraphConnection nodeLabel nodeTypeLabel arcLabel arcTypeLabel = (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel -> IO ()) -> IO (GraphConnectionData nodeLabel nodeTypeLabel arcLabel arcTypeLabel) Source #

data GraphConnectionData nodeLabel nodeTypeLabel arcLabel arcTypeLabel Source #

Constructors

GraphConnectionData 

Fields

newtype PartialShow a Source #

Constructors

PartialShow a 

Instances

Instances details
Show (PartialShow a) => Show (PartialShow [a]) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> PartialShow [a] -> ShowS #

show :: PartialShow [a] -> String #

showList :: [PartialShow [a]] -> ShowS #

Show (PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel)) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> ShowS #

show :: PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> String #

showList :: [PartialShow (CannedGraph nodeLabel nodeTypeLabel arcLabel arcTypeLabel)] -> ShowS #

Show (PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel)) Source # 
Instance details

Defined in Graphs.Graph

Methods

showsPrec :: Int -> PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> ShowS #

show :: PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel) -> String #

showList :: [PartialShow (Update nodeLabel nodeTypeLabel arcLabel arcTypeLabel)] -> ShowS #

Show (PartialShow (NodeData nodeInfo arcInfo)) Source # 
Instance details

Defined in Graphs.PureGraph

Methods

showsPrec :: Int -> PartialShow (NodeData nodeInfo arcInfo) -> ShowS #

show :: PartialShow (NodeData nodeInfo arcInfo) -> String #

showList :: [PartialShow (NodeData nodeInfo arcInfo)] -> ShowS #

Show (PartialShow (PureGraph nodeInfo arcInfo)) Source # 
Instance details

Defined in Graphs.PureGraph

Methods

showsPrec :: Int -> PartialShow (PureGraph nodeInfo arcInfo) -> ShowS #

show :: PartialShow (PureGraph nodeInfo arcInfo) -> String #

showList :: [PartialShow (PureGraph nodeInfo arcInfo)] -> ShowS #