Details
Graph vertices can be thought of as named memory locations for both inputs and outputs.
Evaluation distinguishes inputs as the set of root vertices not pointed to by any directed edge (sources).
All other vertices reached by following directed edges are considered outputs.
A vertex
vi and its edge
are both said to precede another vertex
vj, if the
graph indeed contains edge
.
Values (or weights) wi are assigned to vertices vi using rules of the form vi→wi.
Input rules should list vi→wi for all input vertices vi.
If input values are missing from rules, vertex names vi are assumed as values.
If rules includes a rule for an output vertex vi, the associated value is ignored and overwritten upon evaluation.
Function vfun accepts three arguments parallel over index i:
#1 | a list of values wi on all vertices vi preceeding vj |
#2 | a list of edge weights wij for each preceeding edge |
#3 | a list of all preceeding edges |
If
vfun is specified as a symbol
sym (such as
Times or
Plus), then
vfun=sym@@#1&.
Optional specification of
may simplify some calculations.
Values in
#2 are obtained most efficiently using an
Association, so it is possible to get a
Missing["KeyAbsent",_] error if the list of
EdgeWeights is incomplete.
Association expr has a primary key "Graph", which should point to a directed acyclic
graph.
"VertexWeights" | {} | a list of function values |
"VertexFunction" | Plus | determines how to fold over incoming values |
"EdgeWeights" | {} | weights or phases per graph edge |
The
Association expr is then effectively its own type of expression, which should have a definite evaluation.
Any expr that conforms to the schema outlined above should ultimately be easy to compile for optimized evaluation.
Ultimately,
ResourceFunction["DirectedAcyclicEvaluate"] returns a complete
Association listing all function values under key "VertexWeights".
The output
Association is certified in the sense that it is locally checkable on every graph vertex.