graphite-0.10.0.1: Graphs and networks library

Safe HaskellSafe
LanguageHaskell2010

Data.Graph.UGraph

Contents

Synopsis

UGraph data type

data UGraph v e Source #

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

Instances
Graph UGraph Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

empty :: Hashable v => UGraph v e Source #

order :: UGraph v e -> Int Source #

size :: (Hashable v, Eq v) => UGraph v e -> Int Source #

density :: (Hashable v, Eq v) => UGraph v e -> Double Source #

vertices :: UGraph v e -> [v] Source #

edgeTriples :: (Hashable v, Eq v) => UGraph v e -> [(v, v, e)] Source #

edgePairs :: (Hashable v, Eq v) => UGraph v e -> [(v, v)] Source #

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

areAdjacent :: (Hashable v, Eq v) => UGraph v e -> v -> v -> Bool Source #

adjacentVertices :: (Hashable v, Eq v) => UGraph v e -> v -> [v] Source #

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

reachableAdjacentVertices :: (Hashable v, Eq v) => UGraph v e -> v -> [v] Source #

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

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

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

maxDegree :: (Hashable v, Eq v) => UGraph v e -> Int Source #

minDegree :: (Hashable v, Eq v) => UGraph v e -> Int Source #

avgDegree :: (Hashable v, Eq v) => UGraph v e -> Double Source #

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

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

containsEdgePair :: (Hashable v, Eq v) => UGraph v e -> (v, v) -> Bool Source #

incidentEdgeTriples :: (Hashable v, Eq v) => UGraph v e -> v -> [(v, v, e)] Source #

incidentEdgePairs :: (Hashable v, Eq v) => UGraph v e -> v -> [(v, v)] Source #

edgeTriple :: (Hashable v, Eq v) => UGraph v e -> v -> v -> Maybe (v, v, e) Source #

insertEdgeTriple :: (Hashable v, Eq v) => (v, v, e) -> UGraph v e -> UGraph v e Source #

insertEdgeTriples :: (Hashable v, Eq v) => [(v, v, e)] -> UGraph v e -> UGraph v e Source #

insertEdgePair :: (Hashable v, Eq v) => (v, v) -> UGraph v () -> UGraph v () Source #

insertEdgePairs :: (Hashable v, Eq v) => [(v, v)] -> UGraph v () -> UGraph v () Source #

removeVertex :: (Hashable v, Eq v) => v -> UGraph v e -> UGraph v e Source #

removeVertices :: (Hashable v, Eq v) => [v] -> UGraph v e -> UGraph v e Source #

removeEdgePair :: (Hashable v, Eq v) => (v, v) -> UGraph v e -> UGraph v e Source #

removeEdgePairs :: (Hashable v, Eq v) => [(v, v)] -> UGraph v e -> UGraph v e Source #

removeEdgePairAndVertices :: (Hashable v, Eq v) => (v, v) -> UGraph v e -> UGraph v e Source #

isolatedVertices :: (Hashable v, Eq v) => UGraph v e -> [v] Source #

isSimple :: (Hashable v, Eq v) => UGraph v e -> Bool Source #

union :: (Hashable v, Eq v) => UGraph v e -> UGraph v e -> UGraph v e Source #

intersection :: (Hashable v, Eq v, Eq e) => UGraph v e -> UGraph v e -> UGraph v e Source #

toList :: (Hashable v, Eq v) => UGraph v e -> [(v, [(v, e)])] Source #

fromList :: (Hashable v, Eq v) => [(v, [(v, e)])] -> UGraph v e Source #

fromAdjacencyMatrix :: [[Int]] -> Maybe (UGraph Int ()) Source #

(Hashable v, Eq v) => Functor (UGraph v) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

fmap :: (a -> b) -> UGraph v a -> UGraph v b #

(<$) :: a -> UGraph v b -> UGraph v a #

(Hashable v, Eq v) => Foldable (UGraph v) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

fold :: Monoid m => UGraph v m -> m #

foldMap :: Monoid m => (a -> m) -> UGraph v a -> m #

foldr :: (a -> b -> b) -> b -> UGraph v a -> b #

foldr' :: (a -> b -> b) -> b -> UGraph v a -> b #

foldl :: (b -> a -> b) -> b -> UGraph v a -> b #

foldl' :: (b -> a -> b) -> b -> UGraph v a -> b #

foldr1 :: (a -> a -> a) -> UGraph v a -> a #

foldl1 :: (a -> a -> a) -> UGraph v a -> a #

toList :: UGraph v a -> [a] #

null :: UGraph v a -> Bool #

length :: UGraph v a -> Int #

elem :: Eq a => a -> UGraph v a -> Bool #

maximum :: Ord a => UGraph v a -> a #

minimum :: Ord a => UGraph v a -> a #

sum :: Num a => UGraph v a -> a #

product :: Num a => UGraph v a -> a #

(Eq v, Eq e) => Eq (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

(==) :: UGraph v e -> UGraph v e -> Bool #

(/=) :: UGraph v e -> UGraph v e -> Bool #

(Hashable v, Eq v, Read v, Read e) => Read (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

(Hashable v, Eq v, Show v, Show e) => Show (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

showsPrec :: Int -> UGraph v e -> ShowS #

show :: UGraph v e -> String #

showList :: [UGraph v e] -> ShowS #

Generic (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Associated Types

type Rep (UGraph v e) :: Type -> Type #

Methods

from :: UGraph v e -> Rep (UGraph v e) x #

to :: Rep (UGraph v e) x -> UGraph v e #

(Hashable v, Eq v) => Semigroup (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

(<>) :: UGraph v e -> UGraph v e -> UGraph v e #

sconcat :: NonEmpty (UGraph v e) -> UGraph v e #

stimes :: Integral b => b -> UGraph v e -> UGraph v e #

(Hashable v, Eq v) => Monoid (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

mempty :: UGraph v e #

mappend :: UGraph v e -> UGraph v e -> UGraph v e #

mconcat :: [UGraph v e] -> UGraph v e #

(Arbitrary v, Arbitrary e, Hashable v, Num v, Ord v) => Arbitrary (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

arbitrary :: Gen (UGraph v e) #

shrink :: UGraph v e -> [UGraph v e] #

(NFData v, NFData e) => NFData (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

Methods

rnf :: UGraph v e -> () #

type Rep (UGraph v e) Source # 
Instance details

Defined in Data.Graph.UGraph

type Rep (UGraph v e)

Functions on UGraph

insertEdge :: (Hashable v, Eq v) => Edge v e -> UGraph v e -> UGraph v e Source #

Insert an undirected Edge into a UGraph

The involved vertices are inserted if they don't exist. If the graph already contains the Edge, its attribute gets updated

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

Same as insertEdge but for a list of Edges

removeEdge :: (Hashable v, Eq v) => Edge v e -> UGraph v e -> UGraph v e Source #

Remove the undirected Edge from a UGraph if present. The involved vertices are left untouched

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

Same as removeEdge but for a list of Edges

removeEdgeAndVertices :: (Hashable v, Eq v) => Edge v e -> UGraph v e -> UGraph v e Source #

Remove the undirected Edge from a UGraph if present. The involved vertices also get removed

edges :: forall v e. (Hashable v, Eq v) => UGraph v e -> [Edge v e] Source #

Retrieve the Edges of a UGraph

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

Tell if an undirected Edge exists in the graph

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

Retrieve the incident Edges of a Vertex

List conversions

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

Convert a UGraph to a list of Edges discarding isolated vertices

Note that because toEdgesList discards isolated vertices: > fromEdgesList . toEdgesList /= id

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

Construct a UGraph from a list of Edges

Pretty printing

prettyPrint :: (Hashable v, Eq v, Show v, Show e) => UGraph v e -> String Source #

Pretty print a UGraph