| Safe Haskell | Safe | 
|---|---|
| Language | Haskell2010 | 
Data.Chatty.Graph
Description
Provides a general graph.
Synopsis
- newtype NodeId = NodeId Int
 - data Graph a b c = Graph {}
 - data Node a = Node {
- nodeMarked :: Bool
 - nodeContent :: a
 - nodeId :: NodeId
 
 - data Edge b c = Edge {}
 - incId :: NodeId -> NodeId
 - emptyGraph :: Graph a b c
 - addNode :: a -> Graph a b c -> Graph a b c
 - addNode' :: a -> Graph a b c -> (NodeId, Graph a b c)
 - addNodes :: [a] -> Graph a b c -> Graph a b c
 - addNodes' :: [a] -> Graph a b c -> ([NodeId], Graph a b c)
 - allNodes :: Graph a b c -> [Node a]
 - rootNode :: Graph a b c -> NodeId
 - addEdge :: NodeId -> NodeId -> Int -> b -> c -> Graph a b c -> Graph a b c
 - addEdge' :: Edge b c -> Graph a b c -> Graph a b c
 - addMutualEdge :: NodeId -> NodeId -> Int -> b -> c -> Graph a b c -> Graph a b c
 - addEdges :: [(NodeId, NodeId, Int, b, c)] -> Graph a b c -> Graph a b c
 - addEdges' :: [Edge b c] -> Graph a b c -> Graph a b c
 - addMutualEdges :: [(NodeId, NodeId, Int, b, c)] -> Graph a b c -> Graph a b c
 - getNode :: NodeId -> Graph a b c -> a
 - getNode' :: NodeId -> Graph a b c -> Node a
 - setNode :: NodeId -> a -> Graph a b c -> Graph a b c
 - markNode :: NodeId -> Graph a b c -> Graph a b c
 - followEdge :: Eq b => NodeId -> b -> Graph a b c -> Maybe NodeId
 - queryEdge :: Eq b => NodeId -> b -> Graph a b c -> Maybe c
 - listEdges :: NodeId -> Graph a b c -> [(b, c, NodeId)]
 
Documentation
Phantom type for a node ID
A general graph
A node for the graph
Constructors
| Node | |
Fields 
  | |
An edge for the graph
emptyGraph :: Graph a b c Source #
An empty graph
addNode' :: a -> Graph a b c -> (NodeId, Graph a b c) Source #
Add a node to the graph and also return its ID
addNodes' :: [a] -> Graph a b c -> ([NodeId], Graph a b c) Source #
Add a bunch of nodes and also return their IDs
addEdge :: NodeId -> NodeId -> Int -> b -> c -> Graph a b c -> Graph a b c Source #
Add a unidirectional edge to the graph (provide both nodes, a weight and a label)
addEdge' :: Edge b c -> Graph a b c -> Graph a b c Source #
Add a unidirectional edge to the graph (provide the Edge)
addMutualEdge :: NodeId -> NodeId -> Int -> b -> c -> Graph a b c -> Graph a b c Source #
Add a bidirectional edge to the graph (provide both nodes, a weight and a label)
addEdges :: [(NodeId, NodeId, Int, b, c)] -> Graph a b c -> Graph a b c Source #
Add a bunch of edges unidirectionally (provide both nodes, a weight and a label)
addEdges' :: [Edge b c] -> Graph a b c -> Graph a b c Source #
Add a bunch of edges unidirectionally (provide the Edges)
addMutualEdges :: [(NodeId, NodeId, Int, b, c)] -> Graph a b c -> Graph a b c Source #
Add a bunch of edges bidirectionally (provide both nodes, a weight and a label)