unordered-graphs-0.1.0: Graph library using unordered-containers

Copyright(c) Ivan Lazar Miljenovic
LicenseMIT
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Data.Graph.Unordered.Internal

Description

 

Synopsis

Documentation

data Graph et n nl el Source

Constructors

Gr 

Fields

nodeMap :: !(NodeMap n nl)
 
edgeMap :: !(EdgeMap et n el)
 
nextEdge :: !Edge
 

Instances

(Eq (et n), Eq n, Eq nl, Eq el) => Eq (Graph et n nl el) Source 
(ValidGraph et n, Read n, Read nl, Read el) => Read (Graph et n nl el) Source 
(EdgeType et, Show n, Show nl, Show el) => Show (Graph et n nl el) Source 
(NFData n, NFData (et n), NFData nl, NFData el) => NFData (Graph et n nl el) Source 

type NodeMap n nl = HashMap n (Adj, nl) Source

type EdgeMap et n el = HashMap Edge (et n, el) Source

newtype Edge Source

Constructors

Edge 

Fields

unEdge :: Word
 

Instances

Bounded Edge Source 
Enum Edge Source 
Eq Edge Source 
Ord Edge Source 
Read Edge Source 
Show Edge Source 
NFData Edge Source 
Hashable Edge Source 
ToContext (n, nl, AdjLookup (at n) el) Source 
FromContext (n, nl, AdjLookup (at n) el) Source 
Contextual (n, nl, AdjLookup (at n) el) Source 
type CNode (n, nl, AdjLookup (at n) el) = n Source 
type CAType (n, nl, AdjLookup (at n) el) = at Source 
type CNLabel (n, nl, AdjLookup (at n) el) = nl Source 
type CELabel (n, nl, AdjLookup (at n) el) = el Source 

type Set n = HashMap n () Source

mkSet :: (Eq n, Hashable n) => [n] -> Set n Source

adjCount :: Eq n => n -> n -> Int Source

type ValidGraph et n = (Hashable n, Eq n, EdgeType et) Source

mkGraph :: ValidGraph et n => [(n, nl)] -> [(n, n, el)] -> Graph et n nl el Source

Assumes all nodes are in the node list.

class (Functor et, NodeFrom (AdjType et)) => EdgeType et where Source

Associated Types

type AdjType et :: * -> * Source

Methods

mkEdge :: n -> n -> et n Source

otherN :: Eq n => n -> et n -> AdjType et n Source

Assumes n is one of the end points of this edge.

toEdge :: n -> AdjType et n -> et n Source

edgeNodes :: et n -> [n] Source

Returns a list of length 2.

edgeTriple :: (et n, el) -> (n, n, el) Source

Instances

EdgeType UndirEdge Source 
EdgeType DirEdge Source

Note that for loops, the result of otherN will always be a ToNode.

class NodeFrom at where Source

Methods

getNode :: at n -> n Source

nodeDetails :: Graph et n nl el -> [(n, ([Edge], nl))] Source

lnodes :: Graph et n nl el -> [(n, nl)] Source

edges :: Graph et n nl el -> [Edge] Source

edgeDetails :: Graph et n nl el -> [(Edge, (et n, el))] Source

ledges :: Graph et n nl el -> [(Edge, el)] Source

edgePairs :: EdgeType et => Graph et n nl el -> [(n, n)] Source

ledgePairs :: EdgeType et => Graph et n nl el -> [(n, n, el)] Source

degNM :: (Eq n, Hashable n) => NodeMap n nl -> n -> Int Source

withNodeMap :: (NodeMap n nl -> NodeMap n nl') -> Graph et n nl el -> Graph et n nl' el Source

withEdgeMap :: (EdgeMap et n el -> EdgeMap et n el') -> Graph et n nl el -> Graph et n nl el' Source