Safe Haskell | None |
---|

- data Graph e v = Graph {}
- emptyGraph :: Graph e v
- insertVertex :: Eq v => v -> Graph e v -> Graph e v
- removeVertex :: Eq v => v -> Graph e v -> Graph e v
- removeVertices :: Eq v => [v] -> Graph e v -> Graph e v
- removeEdge :: Eq e => e -> Graph e v -> Graph e v
- insertEdge :: Eq v => e -> (v, v) -> Graph e v -> Graph e v
- insertVertices :: Eq b => [b] -> Graph e b -> Graph e b
- insertEdges :: Eq v => [(e, v, v)] -> Graph e v -> Graph e v
- modifyVertex :: Eq v => (v -> v) -> v -> Graph e v -> Graph e v
- modifyEdge :: Eq e => (e -> e) -> e -> Graph e v -> Graph e v
- connections :: Eq v => v -> Graph e v -> [(e, v)]
- neighbors :: Eq v => v -> Graph e v -> [v]
- fromLists :: Eq v => [v] -> [(e, v, v)] -> Graph e v
- degree :: Eq v => v -> Graph e v -> Int
- subgraph :: Eq v => [v] -> Graph e v -> Graph e v
- moveFromTo :: Eq v => v -> v -> Graph e v -> Maybe v
- moveFromThrough :: (Eq v, Eq e) => v -> e -> Graph e v -> Maybe v
- module Graphene.Class

# Documentation

Graph with edge type `e`

and vertex type `v`

emptyGraph :: Graph e vSource

a graph with no vertices or edges

insertVertex :: Eq v => v -> Graph e v -> Graph e vSource

Insert a vertex into a graph

removeVertex :: Eq v => v -> Graph e v -> Graph e vSource

Remove a vertex V from a graph | (Also removes edges connected to V)

removeVertices :: Eq v => [v] -> Graph e v -> Graph e vSource

Remove a list of vertices from a graph

removeEdge :: Eq e => e -> Graph e v -> Graph e vSource

Remove an edge from a graph

insertEdge :: Eq v => e -> (v, v) -> Graph e v -> Graph e vSource

Inset an edge into a graph connected to two vertices

insertVertices :: Eq b => [b] -> Graph e b -> Graph e bSource

Insert a list of edges into a graph

insertEdges :: Eq v => [(e, v, v)] -> Graph e v -> Graph e vSource

Insert a list of edges into a graph

modifyVertex :: Eq v => (v -> v) -> v -> Graph e v -> Graph e vSource

Modify a vertex in a graph by an automorphism | If such a vertex doesn't exist, modifyVertex = id

modifyEdge :: Eq e => (e -> e) -> e -> Graph e v -> Graph e vSource

Modify an edge in a graph by an automorphism | If such an edge doesn't exist, modifyEdge = id

connections :: Eq v => v -> Graph e v -> [(e, v)]Source

find edge connections and vertex neighbors to a vertex

fromLists :: Eq v => [v] -> [(e, v, v)] -> Graph e vSource

Generate a graph froma list of edges and a list of edge / 2 vertex pairs

moveFromTo :: Eq v => v -> v -> Graph e v -> Maybe vSource

move to a adjacent vertex (returns the next vertex if it really is connected)

moveFromThrough :: (Eq v, Eq e) => v -> e -> Graph e v -> Maybe vSource

follow an edge to a new adjancent vertex (returns the new vertex)

module Graphene.Class