CurryInfo: icurry-3.2.0 / TermGraph.SVG.graphMetric

definition:
graphMetric :: GraphMetric n => (Int -> Int -> Int, Int -> Int) -> [NodeID]
            -> [n] -> NodeID -> (Int, [NodeID])
graphMetric (aggr, incr) visited graph curr =
  let children = nodeChildrenById graph curr
  in case children of
    []  -> (1, curr : visited)
    _:_ | elem curr visited -> (1, visited)
        | otherwise -> incDepth (summarize (curr : visited) children)
 where
  incDepth (d,v)       = (incr d,v)
  summarize vis []     = (0, vis)
  summarize vis (c:cs) =
    let (currsum, currvis) = graphMetric (aggr, incr) vis graph c
        (nextsum, nextvis) = summarize currvis cs
    in (aggr currsum nextsum, nextvis)
demand:
arguments 1 2
deterministic:
deterministic operation
documentation:
-- calculate depth or width of a given graph. Also return a list of visited Nodes
failfree:
(_, _, _, _, _)
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,{(,)},_,_,_) |-> {(,)}}
name:
graphMetric
precedence:
no precedence defined
result-values:
{(,)}
signature:
GraphMetric a => (Prelude.Int -> Prelude.Int -> Prelude.Int, Prelude.Int
-> Prelude.Int) -> [Prelude.Int] -> [a] -> Prelude.Int
-> (Prelude.Int, [Prelude.Int])
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
reducible on all ground data terms