IntGraph-0.1.0.0: Dynamically sized graph library

Safe HaskellSafe
LanguageHaskell2010

Data.IntGraph.Undirected

Description

Functions for interacting with a graph as an undirected graph

Synopsis

Documentation

type Node = Int Source #

The nodes of the graph are Ints

type NodeSet = Set Node Source #

A NodeSet is a Set of Nodes

type Edge = (Node, Node) Source #

An edge is a pair of nodes

data IntGraph Source #

An IntGraph is a maping of Ints (Nodes) to sets of Nodes (Ints)

empty :: IntGraph Source #

the empty graph

addNode :: Node -> IntGraph -> IntGraph Source #

Adds a single node with no neighbors. | If node already in graph, does nothing.

nodes :: IntGraph -> [Node] Source #

Returns a list of the nodes in the graph

removeNode :: Node -> IntGraph -> IntGraph Source #

removes a node and all its incident edges

addEdge :: Edge -> IntGraph -> IntGraph Source #

Add an edge to the graph | If either nodes is not already in the graph, they are added

edges :: IntGraph -> [Edge] Source #

Returns a list of all edges in the graph

removeEdge :: Edge -> IntGraph -> IntGraph Source #

remove an edge from the graph

fromEdges :: [Edge] -> IntGraph Source #

turns a list of edges into a graph