Handle compound medial tires in cut labelling

This commit is contained in:
2026-06-15 21:46:56 -04:00
parent 37a7ff0b00
commit 1e8bee04ce
5 changed files with 296 additions and 110 deletions
@@ -205,7 +205,8 @@ def label_and_cut(graph: FullMedialTireGraph, entry_edge: int,
def up_apex_cuts(graph: FullMedialTireGraph, entry_edge: int,
bij: Mapping[str, object] | None = None) -> dict[int, object]:
bij: Mapping[str, object] | None = None,
shared_apexes: set[object] | None = None) -> dict[int, object]:
"""Up-tooth apex cuts prescribed after the walk-depth traversal.
The returned dict maps each cut up-tooth edge to the apex vertex to
@@ -218,11 +219,12 @@ def up_apex_cuts(graph: FullMedialTireGraph, entry_edge: int,
i: (bij[f"u{i}"] if bij is not None else graph.apex_of_edge(i))
for i in graph.up_edges
}
shared_apexes = shared_apexes or set()
multiplicity = Counter(apex_by_edge.values())
return {
i: apex
for i, apex in apex_by_edge.items()
if i != entry_edge and multiplicity[apex] == 1
if i != entry_edge and multiplicity[apex] == 1 and apex not in shared_apexes
}