Skip to content

Latest commit

 

History

History
57 lines (47 loc) · 2.29 KB

File metadata and controls

57 lines (47 loc) · 2.29 KB

Edge and Event Generations

"EdgeGenerationsList" (aka "ExpressionGenerations") yields the list of generation numbers (numbers of predecessor layers) for each edge in "AllEventsEdgesList":

In[] := WolframModel[{{1, 2}, {1, 3}, {1, 4}} ->
  {{2, 2}, {3, 2}, {3, 4}, {3, 5}},
 {{1, 1}, {1, 1}, {1, 1}}, 5, "EdgeGenerationsList"]
Out[] = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5,
   5, 5, 5, 5}

"AllEventsGenerationsList" (aka "EventGenerations") gives the same for events. The generation of an event is defined as the generation of edges it produces as output. Here edges of different generations are colored differently:

In[] := With[{
  evolution = WolframModel[{{1, 2}, {1, 3}, {1, 4}} ->
     {{2, 2}, {3, 2}, {3, 4}, {3, 5}},
    {{1, 1}, {1, 1}, {1, 1}}, 5]},
 MapThread[
  HypergraphPlot[#, EdgeStyle -> #2] &, {evolution["StatesList"],
   Replace[evolution[
        "EdgeGenerationsList"][[#]] & /@ (evolution[
         "StateEdgeIndicesAfterEvent", #] &) /@
      Prepend[0] @ Accumulate @ evolution["GenerationEventsCountList"],
    g_ :> ColorData["Rainbow"][g/5], {2}]}]]

Out[] = {
... 6 hypergraph plots showing edges of multiple generations in the same state starting from the 3rd plot ...
}

Event and expression generations correspond to layers in "LayeredCausalGraph" and "ExpressionsEventsGraph":

In[] := WolframModel[{{1, 2}, {1, 3}, {1, 4}} ->
  {{2, 2}, {3, 2}, {3, 4}, {3, 5}},
 {{1, 1}, {1, 1}, {1, 1}}, 5, "AllEventsGenerationsList"]
Out[] = {1, 2, 3, 4, 5, 5}
In[] := WolframModel[{{1, 2}, {1, 3}, {1, 4}} ->
  {{2, 2}, {3, 2}, {3, 4}, {3, 5}},
 {{1, 1}, {1, 1}, {1, 1}}, 5, "LayeredCausalGraph"]

Out[] = ... causal graph showing 5 generations, some edges cross multiple generations, e.g., 1 -> 3 ...