Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type EdgeList e = [GraphEdge e]
- class Graph g where
- fromList :: (Ord v, Eq v) => ([v], [GraphEdge e]) -> g v e
- toList :: (Ord v, Eq v) => g v e -> ([v], [GraphEdge e])
- vCount :: g v e -> Int
- (!>) :: (Ord v, Eq v) => g v e -> v -> [(v, e)]
- (!.) :: g v e -> Int -> [(Int, e)]
- (?>) :: (Ord v, Eq v) => g v e -> v -> Maybe [(v, e)]
- (?.) :: g v e -> Int -> Maybe [(Int, e)]
- incident :: (Ord v, Eq v) => g v e -> v -> [(v, v, e)]
- safeIncident :: (Ord v, Eq v) => g v e -> v -> Maybe [(v, v, e)]
- incidentIdx :: Eq e => g v e -> Int -> [GraphEdge e]
- safeIncidentIdx :: Eq e => g v e -> Int -> Maybe [GraphEdge e]
- type GraphEdge e = (Int, Int, e)
- changeIndsEdge :: (Int -> Int) -> GraphEdge e -> GraphEdge e
- changeTypeEdge :: (e1 -> e2) -> GraphEdge e1 -> GraphEdge e2
- edgeType :: GraphEdge e -> e
Documentation
Type class that gives data structure properties of graph.
fromList :: (Ord v, Eq v) => ([v], [GraphEdge e]) -> g v e Source #
Construct a graph from list of vertices and edges.
toList :: (Ord v, Eq v) => g v e -> ([v], [GraphEdge e]) Source #
Get a list of all vertices and edges from the graph.
vCount :: g v e -> Int Source #
Get the number of vertices.
(!>) :: (Ord v, Eq v) => g v e -> v -> [(v, e)] infixl 9 Source #
Unsafe get adjacent vertices.
(!.) :: g v e -> Int -> [(Int, e)] infixl 9 Source #
Unsafe get adjacent indices.
(?>) :: (Ord v, Eq v) => g v e -> v -> Maybe [(v, e)] infixl 9 Source #
Safe get adjacent vertices.
(?.) :: g v e -> Int -> Maybe [(Int, e)] infixl 9 Source #
Safe get adjacent indices.
incident :: (Ord v, Eq v) => g v e -> v -> [(v, v, e)] Source #
Get a list of edges starting at given vertex.
safeIncident :: (Ord v, Eq v) => g v e -> v -> Maybe [(v, v, e)] Source #
Safe get a list of edges starting at given vertex.
incidentIdx :: Eq e => g v e -> Int -> [GraphEdge e] Source #
Get a list of index edges starting at given vertex.
safeIncidentIdx :: Eq e => g v e -> Int -> Maybe [GraphEdge e] Source #
Safe get a list of index edges starting at given vertex.
Instances
Graph GenericGraph Source # | |
Defined in Math.Grads.GenericGraph fromList :: (Ord v, Eq v) => ([v], [GraphEdge e]) -> GenericGraph v e Source # toList :: (Ord v, Eq v) => GenericGraph v e -> ([v], [GraphEdge e]) Source # vCount :: GenericGraph v e -> Int Source # (!>) :: (Ord v, Eq v) => GenericGraph v e -> v -> [(v, e)] Source # (!.) :: GenericGraph v e -> Int -> [(Int, e)] Source # (?>) :: (Ord v, Eq v) => GenericGraph v e -> v -> Maybe [(v, e)] Source # (?.) :: GenericGraph v e -> Int -> Maybe [(Int, e)] Source # incident :: (Ord v, Eq v) => GenericGraph v e -> v -> [(v, v, e)] Source # safeIncident :: (Ord v, Eq v) => GenericGraph v e -> v -> Maybe [(v, v, e)] Source # incidentIdx :: Eq e => GenericGraph v e -> Int -> [GraphEdge e] Source # safeIncidentIdx :: Eq e => GenericGraph v e -> Int -> Maybe [GraphEdge e] Source # |
type GraphEdge e = (Int, Int, e) Source #
GraphEdge
is just triple, containing index of starting vertex of edge,
index of ending vertex of edge and edge's type.
changeIndsEdge :: (Int -> Int) -> GraphEdge e -> GraphEdge e Source #
Given transformation of edge's indices transforms GraphEdge
.