-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Tools for working on (di)graphs.
--
-- Tools for working on (di)graphs.
@package hgraph
@version 1.2.0.1
module HGraph.Directed
class DirectedGraph t
empty :: DirectedGraph t => t a -> t a
vertices :: DirectedGraph t => t a -> [a]
numVertices :: (DirectedGraph t, Integral b) => t a -> b
arcs :: DirectedGraph t => t a -> [(a, a)]
numArcs :: (DirectedGraph t, Integral b) => t a -> b
linearizeVertices :: DirectedGraph t => t a -> (t Int, [(Int, a)])
isVertex :: DirectedGraph t => t a -> a -> Bool
class Adjacency t
outneighbors :: Adjacency t => t a -> a -> [a]
inneighbors :: Adjacency t => t a -> a -> [a]
outdegree :: (Adjacency t, Integral b) => t a -> a -> b
indegree :: (Adjacency t, Integral b) => t a -> a -> b
arcExists :: Adjacency t => t a -> (a, a) -> Bool
metaBfs :: (Adjacency t, Ord a) => t a -> a -> ([a] -> [a]) -> ([a] -> [a]) -> [a]
class Mutable t
addVertex :: Mutable t => a -> t a -> t a
removeVertex :: Mutable t => a -> t a -> t a
addArc :: Mutable t => (a, a) -> t a -> t a
removeArc :: Mutable t => (a, a) -> t a -> t a
module HGraph.Directed.AdjacencyMap
data Digraph a
emptyDigraph :: Ord a => Digraph a
instance HGraph.Directed.DirectedGraph HGraph.Directed.AdjacencyMap.Digraph
instance HGraph.Directed.Adjacency HGraph.Directed.AdjacencyMap.Digraph
instance HGraph.Directed.Mutable HGraph.Directed.AdjacencyMap.Digraph
module HGraph.Directed.Connectivity.Flow
maxFlow :: (Ord a, Adjacency t, DirectedGraph t) => t a -> a -> a -> Map (a, a) Bool
maxDisjointPaths :: (Mutable t, DirectedGraph t, Adjacency t, Integral a) => t a -> a -> a -> [[a]]
minCut :: (Mutable t, DirectedGraph t, Adjacency t, Eq a) => t a -> a -> a -> [a]
minCutI :: (Mutable t, DirectedGraph t, Adjacency t, Integral a) => t a -> a -> a -> [a]
module HGraph.Directed.Output
toDot :: (Ord a, Show a, DirectedGraph t) => t a -> DotStyle a -> [Char]
data DotStyle a
DotStyle :: String -> [(String, String)] -> [(String, String)] -> Map a [(String, String)] -> Map (a, a) [(String, String)] -> DotStyle a
[graphName] :: DotStyle a -> String
[everyNode] :: DotStyle a -> [(String, String)]
[everyEdge] :: DotStyle a -> [(String, String)]
[nodeAttributes] :: DotStyle a -> Map a [(String, String)]
[edgeAttributes] :: DotStyle a -> Map (a, a) [(String, String)]
defaultDotStyle :: DotStyle a
module HGraph.Undirected
class UndirectedGraph t
empty :: UndirectedGraph t => t a -> t a
vertices :: UndirectedGraph t => t a -> [a]
numVertices :: (UndirectedGraph t, Integral b) => t a -> b
edges :: UndirectedGraph t => t a -> [(a, a)]
numEdges :: (UndirectedGraph t, Integral b) => t a -> b
linearizeVertices :: UndirectedGraph t => t a -> (t Int, [(Int, a)])
class UndirectedGraph t => Adjacency t
neighbors :: Adjacency t => t a -> a -> [a]
degree :: (Adjacency t, Integral b) => t a -> a -> b
edgeExists :: Adjacency t => t a -> (a, a) -> Bool
inducedSubgraph :: Adjacency t => t a -> [a] -> t a
metaBfs :: (Adjacency t, Ord a) => t a -> a -> ([a] -> [a]) -> [a]
connectedComponents :: (Adjacency t, Ord a) => t a -> [[a]]
class Mutable t
addVertex :: Mutable t => t a -> a -> t a
removeVertex :: Mutable t => t a -> a -> t a
addEdge :: Mutable t => t a -> (a, a) -> t a
removeEdge :: Mutable t => t a -> (a, a) -> t a
module HGraph.Undirected.AdjacencyMap
data Graph a
emptyGraph :: Ord a => Graph a
instance HGraph.Undirected.UndirectedGraph HGraph.Undirected.AdjacencyMap.Graph
instance HGraph.Undirected.Adjacency HGraph.Undirected.AdjacencyMap.Graph
instance HGraph.Undirected.Mutable HGraph.Undirected.AdjacencyMap.Graph
module HGraph.Undirected.Expanders
-- | Edge expansion of a graph, together with a set of verticies certifying
-- that the expansion is not greater.
edgeExpansion :: (UndirectedGraph g, Adjacency g) => g a -> (Double, [a])
-- | Vertex expansion of a graph, together with a set of verticies
-- certifying that the expansion is not greater.
vertexExpansion :: Adjacency g => g a -> (Double, [a])
module HGraph.Undirected.Generator
grid :: (Num a, Num b, Enum a, Enum b, Mutable t) => t (a, b) -> a -> b -> t (a, b)
cycleGraph :: (Mutable t, Integral a) => t a -> a -> t a
completeTree :: (UndirectedGraph t1, Integral a, Mutable t1, Num t2, Ord t2) => t1 a -> t2 -> Int -> t1 a
completeGraph :: (Mutable t, UndirectedGraph t, Num a, Enum a) => t a -> a -> t a
randomGraph :: (Integral t1, Mutable t2, Random t1, RandomGen g, Adjacency t2) => t2 t1 -> t1 -> t1 -> StateT g Identity (t2 t1)
module HGraph.Undirected.Layout.SpringModel
setup :: UndirectedGraph g => Double -> Double -> Double -> Double -> g a -> SpringModel g a
step :: forall (g :: Type -> Type) a. Adjacency g => Double -> SpringModel g a -> SpringModel g a
positions :: forall (g :: Type -> Type) a. SpringModel g a -> [(a, V2 Double)]
module HGraph.Undirected.Load
loadDot :: Mutable t => t String -> [Char] -> Either String (t String)
module HGraph.Undirected.Output
toDot :: (Show a, UndirectedGraph t) => t a -> [Char]
module HGraph.Undirected.Solvers.Treedepth
optimalDecomposition :: (Adjacency t, Mutable t, Ord a) => t a -> Decomposition a
treedepthAtMost :: (Adjacency t, Num a1, Mutable t, Ord a2, Eq a1) => t a2 -> a1 -> Maybe (Decomposition a2)
isDecomposition :: (Ord a, UndirectedGraph t) => t a -> Decomposition a -> Bool
data Decomposition a
Decomposition :: Map a a -> Map a (Set a) -> Int -> [a] -> Decomposition a
[ancestor] :: Decomposition a -> Map a a
[children] :: Decomposition a -> Map a (Set a)
[depth] :: Decomposition a -> Int
[roots] :: Decomposition a -> [a]
instance GHC.Classes.Eq a => GHC.Classes.Eq (HGraph.Undirected.Solvers.Treedepth.Decomposition a)
instance (GHC.Classes.Ord a, GHC.Show.Show a) => GHC.Show.Show (HGraph.Undirected.Solvers.Treedepth.Decomposition a)
module HGraph.Undirected.Solvers.VertexCover
minimumVertexCover :: (Mutable t, UndirectedGraph t, Adjacency t) => t a -> [a]
vertexCoverAtMost :: (Mutable t, UndirectedGraph t, Adjacency t) => t a -> Int -> Maybe [a]
module HGraph.Undirected.Solvers.IndependentSet
-- | Find a maximum independet set in g
maximize :: (Adjacency t, Mutable t) => t a -> [a]
-- | Search for an independent set of size at least k in
-- g
atLeast :: (Adjacency t, Mutable t) => t a -> Int -> Maybe [a]
reduce :: (Adjacency t, Mutable t) => t a -> Int -> (t a, [a], Int)
module HGraph.Directed.Subgraph
-- | Whether d contains h as a subgraph (the identity is
-- used for the isomorphism).
contains :: (Adjacency t1, Adjacency t2, DirectedGraph t1, DirectedGraph t2) => t2 a -> t1 a -> Bool
-- | Whether h is isomorphic to some subgraph of d.
isSubgraphOf :: (Adjacency t1, Adjacency t2, Ord k2, Ord a, DirectedGraph t1, DirectedGraph t2) => t1 k2 -> t2 a -> Bool
-- | Find an isomorphism from h to some subgraph of d, if
-- it exists.
subgraphIsomorphism :: (Adjacency t1, Adjacency t2, Ord k2, Ord a, DirectedGraph t1, DirectedGraph t2) => t2 a -> t1 k2 -> Maybe (Map k2 a)
subgraphIsomorphismI :: (Adjacency t1, Adjacency t2, Ord a1, Ord a2, DirectedGraph t1, DirectedGraph t2) => t2 a2 -> t1 a1 -> Maybe (Map a1 a2)
-- | Whether phi is a subgraph isomorphism from h to some
-- subgraph of d.
isSubgraphIsomorphism :: (DirectedGraph t1, Ord a1, Adjacency t1, Adjacency t2) => t2 a2 -> t1 a1 -> Map a1 a2 -> Bool
module HGraph.Directed.Load
loadDot :: Mutable t => t Int -> [Char] -> Either String (t Int, Map String Int, Map Int String, Map String [(Name, Name)], Map (String, String) [(Name, Name)])
loadEdgeList :: (Read a, Integral a, Mutable t) => t a -> String -> Either [Char] (t a)
module HGraph.Directed.Connectivity.IntegralLinkage
extendLinkage :: (Mutable t, DirectedGraph t, Adjacency t, Integral a) => t a -> LinkageInstance a -> Maybe (LinkageInstance a)
-- | Finds an integral linkaged connecting the given terminal pairs, if one
-- exists.
linkage :: (DirectedGraph t, Adjacency t, Mutable t, Eq a) => t a -> [(a, a)] -> Maybe [((a, a), [a])]
-- | Special case of linkage where vertices are of type Int.
-- | Faster than calling linkage if vertices of the digraph are
-- already of type Int.
linkageI :: (DirectedGraph t, Adjacency t, Mutable t, Integral a, Ord a, Eq a) => t a -> [(a, a)] -> Maybe [((a, a), [a])]
data LinkageInstance a
LinkageInstance :: Map Int (a, a) -> Map a Int -> Map Int [a] -> LinkageInstance a
[liTerminalPairs] :: LinkageInstance a -> Map Int (a, a)
[liLinkage] :: LinkageInstance a -> Map a Int
[liPath] :: LinkageInstance a -> Map Int [a]
module HGraph.Directed.Connectivity
reachable :: forall a t. (Adjacency t, Ord a) => t a -> a -> a -> Bool
allPaths :: (Ord t1, Adjacency t2) => t2 t1 -> t1 -> t1 -> [[t1]]
allLinkages :: (DirectedGraph t1, Adjacency t1, Eq b, Eq t2, Num t2) => t1 b -> t2 -> b -> b -> [[[b]]]
-- | All maximal paths on a digraph, represented as a list of vertices. |
-- Cycles are also considered as maximal paths and their corresponding
-- lists contain the initial vertex twice.
allMaximalPaths :: (DirectedGraph t, Adjacency t) => t b -> [[b]]
data LinkageInstance a
LinkageInstance :: Map Int (a, a) -> Map a Int -> Map Int [a] -> LinkageInstance a
[liTerminalPairs] :: LinkageInstance a -> Map Int (a, a)
[liLinkage] :: LinkageInstance a -> Map a Int
[liPath] :: LinkageInstance a -> Map Int [a]
module HGraph.Directed.PathAnonymity
pathAnonymity :: (DirectedGraph t, Adjacency t, Ord b1, Num b1) => t b2 -> b1
-- | Path anonymity of a digraph together with a path witnessing | that the
-- anonymity is at least the returned value.
pathAnonymityCertificate :: (DirectedGraph t, Adjacency t, Ord b1, Num b1) => t b2 -> ([b2], b1)
-- | Path anonymity of a maximal path. | The path provided is assumed to be
-- maximal.
pathPathAnonymityI :: (Adjacency t, Ord a, Num p) => t a -> [a] -> p