Skip to main content

to_sheet_graph()

Collapse a cell graph to one node per sheet with consolidated edges.

Usage

Source

to_sheet_graph(
    graph,
    *,
    include_self_loops=False,
)

Sheets that appear as graph nodes are included even when they have no cross-sheet edges. Dangling edge endpoints that do not resolve to a graph node are skipped, matching to_graphviz.

Parameters

graph: GraphReadView

Cell-level dependency graph or read view.

include_self_loops: bool = False
If True, keep intra-sheet cell edges as a single self-loop per sheet. If False (default), drop them.

Returns

SheetGraph

Immutable sheet graph. Node order follows graph.sheet_order when

present; otherwise names sort lexicographically. Edges follow the

same sheet order on (source, target).

present; otherwise names sort lexicographically. Edges follow the

same sheet order on (source, target).