Graph = map Id tosetof Id inv g == dunionrng g subsetdom g;
ASyncGraph = Graph inv asyncg == forall id insetdom asyncg &
id notinset TransClos(asyncg,id);
Path = seqof Id;
Id = nat
functions
Paths: ASyncGraph * Id -> setof Path
Paths(g,id) == let children = g(id) in if children = {} then {[id]} elsedunion {{[id] ^ p | p inset Paths(g,c)}
| c inset children} pre id insetdom g measure measureTransClos;
LinearPath: Graph * Id -> Path
LinearPath(g,id) == let children = g(id) in ifcard children <> 1 or exists parent insetdom g &
parent <> id and children subset g(parent) then [id] elselet child inset children in
[id] ^ LinearPath(g,child) pre id insetdom g and
id notinset TransClos(g,id);
TransClos: Graph * Id -> setof Id
TransClos(g,id) == dunion {TransClosAux(g,c,{})| c inset g(id)} pre id insetdom g;
TransClosAux: Graph * Id * setof Id -> setof Id
TransClosAux(g,id,reached) == if id inset reached then {} else {id} union dunion {TransClosAux(g,c,reached union {id})
| c inset g(id)} pre id insetdom g measure measureGraphReached;
measureGraphReached : Graph * Id * setof Id -> nat
measureGraphReached(g,-,reached) == carddom g - card reached;
AsycDescendents: AcyclicGraph * Id -> setof Id
AsycDescendents(g,id) ==
{id} uniondunion {AsycDescendents(g,c) | c inset g(id)} pre id insetdom g measure measureTransClos;
Descendents: Graph * Id * setof Id -> setof Id
Descendents(g,id,reached) == if id inset reached then {} else {id} union dunion {Descendents(g,c,reached union {id})
| c inset g(id)} pre id insetdom g measure measureGraphReached;
AllDesc: Graph * Id -> setof Id
AllDesc(g,id) == dunion {TransClosAux(g,c,{})| c inset g(id)} pre id insetdom g;
types
AcyclicGraph = Graph inv acg == notexists id insetdom acg &
id inset AllDesc(acg,id);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.