This demo illustrates how relationships between nodes are affected by combos.
Depending on whether or not you take combo nodes into account, the chart can look very different. Graph analysis can either take a top-down approach, in which nodes inside combos are ignored, or a bottom-up approach, in which combo nodes themselves are ignored in favour of the underlying nodes.
In this demo, you can select between top-down and bottom-up analysis to see how shortest path calculations are affected. The shortest path from a to b can be calculated two ways:
In KeyLines, the graph namespace takes a top-down view of the chart, so chart.graph().shortestPaths() will include the outermost combo in its calculation. In order to calculate the underlying shortest path, we have to create a separate graph engine - one which doesn't know about combos.
Various chart functions, including each, filter and foreground, include an items option which allows you to specify whether to iterate over top-level or underlying items.
For more information, see the Running graph analysis section in Combos Concepts.
Key functions used: