Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- newtype Graph v e = Graph {}
- randomGraphIO :: Int -> IO (Graph Int ())
- empty :: Hashable v => Graph v e
- insertVertex :: (Hashable v, Eq v) => v -> Graph v e -> Graph v e
- removeVertex :: (Hashable v, Eq v) => v -> Graph v e -> Graph v e
- insertVertices :: (Hashable v, Eq v) => [v] -> Graph v e -> Graph v e
- insertEdge :: (Hashable v, Eq v) => Edge v e -> Graph v e -> Graph v e
- insertEdges :: (Hashable v, Eq v) => [Edge v e] -> Graph v e -> Graph v e
- removeEdge :: (Hashable v, Eq v) => Edge v e -> Graph v e -> Graph v e
- removeEdge' :: (Hashable v, Eq v) => (v, v) -> Graph v e -> Graph v e
- removeEdgeAndVertices :: (Hashable v, Eq v) => Edge v e -> Graph v e -> Graph v e
- removeEdgeAndVertices' :: (Hashable v, Eq v) => (v, v) -> Graph v e -> Graph v e
- vertices :: Graph v e -> [v]
- order :: Graph v e -> Int
- size :: (Hashable v, Eq v) => Graph v e -> Int
- edges :: forall v e. (Hashable v, Eq v) => Graph v e -> [Edge v e]
- edges' :: (Hashable v, Eq v) => Graph v e -> [(v, v)]
- containsVertex :: (Hashable v, Eq v) => Graph v e -> v -> Bool
- containsEdge :: (Hashable v, Eq v) => Graph v e -> Edge v e -> Bool
- containsEdge' :: (Hashable v, Eq v) => Graph v e -> (v, v) -> Bool
- incidentEdges :: (Hashable v, Eq v) => Graph v e -> v -> [Edge v e]
- vertexDegree :: (Hashable v, Eq v) => Graph v e -> v -> Int
- degrees :: (Hashable v, Eq v) => Graph v e -> [Int]
- maxDegree :: (Hashable v, Eq v) => Graph v e -> Int
- minDegree :: (Hashable v, Eq v) => Graph v e -> Int
- isLoop :: Eq v => Edge v e -> Bool
- isSimple :: (Hashable v, Eq v) => Graph v e -> Bool
- isRegular :: Graph v e -> Bool
- fromAdjacencyMatrix :: [[Int]] -> Maybe (Graph Int ())
- toAdjacencyMatrix :: Graph v e -> [[Int]]

# Documentation

Undirected Graph of Vertices in *v* and Edges with attributes in *e*

insertVertex :: (Hashable v, Eq v) => v -> Graph v e -> Graph v e Source #

`O(log n)`

Insert a vertex into a `Graph`

| If the graph already contains the vertex leave the graph untouched

insertVertices :: (Hashable v, Eq v) => [v] -> Graph v e -> Graph v e Source #

`O(m*log n)`

Insert a many vertices into a `Graph`

| New vertices are inserted and already contained vertices are left untouched

insertEdges :: (Hashable v, Eq v) => [Edge v e] -> Graph v e -> Graph v e Source #

`O(m*log n)`

Insert many directed `Edge`

s into a `Graph`

| Same rules as `insertEdge`

are applied

removeEdge' :: (Hashable v, Eq v) => (v, v) -> Graph v e -> Graph v e Source #

Same as `removeEdge`

but the edge is an unordered pair

removeEdgeAndVertices' :: (Hashable v, Eq v) => (v, v) -> Graph v e -> Graph v e Source #

Same as `removeEdgeAndVertices`

but the edge is an unordered pair

order :: Graph v e -> Int Source #

`O(n)`

Retrieve the order of a `Graph`

| The `order`

of a graph is its number of vertices

edges' :: (Hashable v, Eq v) => Graph v e -> [(v, v)] Source #

Same as `edges`

but the edges are unordered pairs, and their attributes
| are discarded

containsVertex :: (Hashable v, Eq v) => Graph v e -> v -> Bool Source #

`O(log n)`

Tell if a vertex exists in the graph

containsEdge :: (Hashable v, Eq v) => Graph v e -> Edge v e -> Bool Source #

`O(log n)`

Tell if an undirected `Edge`

exists in the graph

containsEdge' :: (Hashable v, Eq v) => Graph v e -> (v, v) -> Bool Source #

Same as `containsEdge`

but the edge is an unordered pair

incidentEdges :: (Hashable v, Eq v) => Graph v e -> v -> [Edge v e] Source #

Retrieve the incident `Edge`

s of a Vertex

vertexDegree :: (Hashable v, Eq v) => Graph v e -> v -> Int Source #

Degree of a vertex
| The total number incident `Edge`

s of a vertex

degrees :: (Hashable v, Eq v) => Graph v e -> [Int] Source #

Degrees of a all the vertices in a `Graph`

isRegular :: Graph v e -> Bool Source #

Tell if a `Graph`

is regular
| An Undirected Graph is `regular`

when all of its vertices have the same
| number of adjacent vertices