DependencyGraph.compress_identity_transits()
Remove identity transit nodes and rewire dependents.
Usage
DependencyGraph.compress_identity_transits(
*,
preserve=None,
record=None,
)Transit nodes whose formula is a single cell reference to one dependency are removed, dependents’ formulas are rewritten, and edges are rewired. Requires dependency provenance from graph construction with capture_dependency_provenance=True for safe edges.
Identity forwarding rewrites CellRefNode leaves only. If a dependent mentions the transit as a RangeNode endpoint or a whole-column/row leaf, the transit is left in place so the formula cannot keep naming a removed node and range geometry is not rewritten.
Skips is_target nodes and any keys in preserve so public extraction and series-bound addresses stay in the graph.
Node hooks are not invoked for removed or updated nodes. Drops formula_shapes; callers who want the overlay must rewarm after compression. write_workbook persists this rewrite into a new .xlsx; prefer IdentityTransitCompression().project when the canonical graph must stay unchanged.
Parameters
preserve: set[NodeKey] | None = None-
Node keys that must not be forwarded. Always unioned with target_keys() so marked targets stay public.
record: IdentityTransitCompressionRecord | None = None- When provided, populate with removal lineage for projection manifests.
Returns
list[NodeKey]- Keys of removed transit nodes, in removal order.