Skip to content

getRootsAndDependents

getRootsAndDependents(workbook): WorkbookRootsAndDependents

Returns an object containing two lists of cells from this workbook:

  • roots are cells with incoming references but no outgoing references.
  • dependents are 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.

  • cumulativeSumInDegrees roughly counts how many cells depend on this root.
  • cumulativeSumOutDegrees roughly 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 cumulativeSumInDegrees of 4.
  • A1 is a dependent, containing a cumulativeSumOutDegrees of 4.
  • B1 and C1 are dependents, containing a cumulativeSumOutDegrees of 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.

Workbook

WorkbookRootsAndDependents