getRootsAndDependents
getRootsAndDependents(
workbook):WorkbookRootsAndDependents
Returns an object containing two lists of cells from this workbook:
rootsare cells with incoming references but no outgoing references.dependentsare all cells that reference any other cells (even if also referenced by other cells further in)
The roots contain a cumulativeSumInDegrees property, and dependents
contain cumulativeSumOutDegrees.
cumulativeSumInDegreesroughly counts how many cells depend on this root.cumulativeSumOutDegreesroughly counts how many cells this cell depends on.
These sums are not exact. In the case of a “diamond-like” dependency graph, double counts occur. Take this example graph:
A1 -> B1, A1 -> C1, B1 -> D1, C1 -> D1
In this graph:
- D1 is a root, containing a
cumulativeSumInDegreesof 4. - A1 is a dependent, containing a
cumulativeSumOutDegreesof 4. - B1 and C1 are dependents, containing a
cumulativeSumOutDegreesof 1.
The cumulative sums can be thought of as an upper bound. The exact number of cells might be lower, but never higher.
The lists are ordered by the sums. These ordered lists can be used to determine the most “impactful” inputs and outputs for a given workbook.