graphite-0.0.1.0: Graphs and networks library

Data.Graph.Types

Synopsis

Documentation

data Edge v e Source #

Undirected Edge with attribute of type e between to Vertices of type v

Constructors

 Edge v v e

Instances

 (Eq v, Eq a) => Eq (Edge v a) Source # To Edges are equal if they point to the same vertices, regardless of the | direction Methods(==) :: Edge v a -> Edge v a -> Bool #(/=) :: Edge v a -> Edge v a -> Bool # (Ord e, Ord v) => Ord (Edge v e) Source # Methodscompare :: Edge v e -> Edge v e -> Ordering #(<) :: Edge v e -> Edge v e -> Bool #(<=) :: Edge v e -> Edge v e -> Bool #(>) :: Edge v e -> Edge v e -> Bool #(>=) :: Edge v e -> Edge v e -> Bool #max :: Edge v e -> Edge v e -> Edge v e #min :: Edge v e -> Edge v e -> Edge v e # (Read e, Read v) => Read (Edge v e) Source # MethodsreadsPrec :: Int -> ReadS (Edge v e) #readList :: ReadS [Edge v e] #readPrec :: ReadPrec (Edge v e) #readListPrec :: ReadPrec [Edge v e] # (Show e, Show v) => Show (Edge v e) Source # MethodsshowsPrec :: Int -> Edge v e -> ShowS #show :: Edge v e -> String #showList :: [Edge v e] -> ShowS # (Arbitrary v, Arbitrary e, Num v, Ord v) => Arbitrary (Edge v e) Source # Methodsarbitrary :: Gen (Edge v e) #shrink :: Edge v e -> [Edge v e] #

data Arc v e Source #

Directed Arc with attribute of type e between to Vertices of type v

Constructors

 Arc v v e

Instances

 (Eq v, Eq a) => Eq (Arc v a) Source # To Arcs are equal if they point to the same vertices, and the directions | is the same Methods(==) :: Arc v a -> Arc v a -> Bool #(/=) :: Arc v a -> Arc v a -> Bool # (Ord e, Ord v) => Ord (Arc v e) Source # Methodscompare :: Arc v e -> Arc v e -> Ordering #(<) :: Arc v e -> Arc v e -> Bool #(<=) :: Arc v e -> Arc v e -> Bool #(>) :: Arc v e -> Arc v e -> Bool #(>=) :: Arc v e -> Arc v e -> Bool #max :: Arc v e -> Arc v e -> Arc v e #min :: Arc v e -> Arc v e -> Arc v e # (Read e, Read v) => Read (Arc v e) Source # MethodsreadsPrec :: Int -> ReadS (Arc v e) #readList :: ReadS [Arc v e] #readPrec :: ReadPrec (Arc v e) #readListPrec :: ReadPrec [Arc v e] # (Show e, Show v) => Show (Arc v e) Source # MethodsshowsPrec :: Int -> Arc v e -> ShowS #show :: Arc v e -> String #showList :: [Arc v e] -> ShowS # (Arbitrary v, Arbitrary e, Num v, Ord v) => Arbitrary (Arc v e) Source # Methodsarbitrary :: Gen (Arc v e) #shrink :: Arc v e -> [Arc v e] #

type Links v e = HashMap v e Source #

Each vertex maps to a Links value so it can poit to other vertices

class Weighted a where Source #

Weighted Edge attributes | Useful for computing some algorithms on graphs

Minimal complete definition

weight

Methods

weight :: a -> Double Source #

Instances

 Source # Methods Source # Methods Source # Methods Source # Methodsweight :: (Double, String) -> Double Source #

class Labeled a where Source #

Labeled Edge attributes | Useful for graph plotting

Minimal complete definition

label

Methods

label :: a -> String Source #

Instances

 Source # Methods Source # Methodslabel :: (Double, String) -> String Source #

arbitraryEdge :: (Arbitrary v, Arbitrary e, Ord v, Num v) => (v -> v -> e -> edge) -> Gen edge Source #

Edges generator

(<->) :: Hashable v => v -> v -> Edge v () Source #

Construct an undirected Edge between two vertices

(-->) :: Hashable v => v -> v -> Arc v () Source #

Construct a directed Arc between two vertices

toOrderedPair :: Arc v a -> (v, v) Source #

Convert an Arc to an ordered pair discarding its attribute

toUnorderedPair :: Edge v a -> (v, v) Source #

Convert an Edge to an unordered pair discarding its attribute

insertLink :: (Hashable v, Eq v) => v -> a -> Links v a -> Links v a Source #

Insert a link directed to *v* with attribute *a* | If the connnection already exists, the attribute is replaced

getLinks :: (Hashable v, Eq v) => v -> HashMap v (Links v e) -> Links v e Source #

Get the links for a given vertex

linksToArcs :: [(v, Links v a)] -> [Arc v a] Source #

Get Arcs from an association list of vertices and their links

linksToEdges :: Eq v => [(v, Links v a)] -> [Edge v a] Source #

Get Edges from an association list of vertices and their links

hashMapInsert :: (Eq k, Hashable k) => k -> v -> HashMap k v -> HashMap k v Source #

O(log n) Associate the specified value with the specified key in this map. | If this map previously contained a mapping for the key, leave the map | intact.