feat(math): add simplicial complex link and f-vector operations (#1850) - #2025
feat(math): add simplicial complex link and f-vector operations (#1850)#2025morluto wants to merge 1 commit into
Conversation
Add two operations to the topology domain: - topology.simplicial_complex.link.compute: compute the link of a simplex in a simplicial complex, returning the facets of the link complex. - topology.simplicial_complex.f_vector.compute: compute the f-vector, h-vector, and Euler characteristic of a simplicial complex. Partially addresses #1850 and #1798.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
morluto
left a comment
There was a problem hiding this comment.
Review verdict: blocked on both added invariants
1. The h-vector repeats #2022's indexing bug
This computes from (f_0, ..., f_d) as though f_0 were f_{-1} and returns one too few entries. A filled triangle is reported as (3, -3, 1) instead of the standard (1, 0, 0, 0). The empty simplex f_{-1}=1 must participate in the defining transformation. Add explicit h-vector tests; the current suite again tests only f-vector/Euler values.
2. LinkRequest does not require its input to be a simplex
It checks only that each vertex exists somewhere in the complex. In a complex with facets [(v0,), (v1,)], the request simplex=(v0, v1) passes even though {v0,v1} is not a face, and the operation silently returns an empty link. Repeated labels such as (v0, v0) also pass and are collapsed by set(), so the output no longer faithfully describes the request.
Require unique simplex vertices and require frozenset(simplex) to belong to the face closure. Also define how the complex containing only the empty face is represented: the link of a maximal facet is {∅}, which is not mathematically identical to the void complex even though this implementation labels both link_is_empty=True.
Overlap
This PR duplicates #2022's operation ID/schema and implementation while adding link support. They cannot both merge cleanly. Prefer one corrected PR (or split link from f/h-vector) and close the overlapping one.
Deep review summaryVerdict: REQUEST CHANGES — both newly advertised invariants are incorrect or under-validated. 1. The h-vector repeats PR #2022's indexing bugThe implementation treats 2.
|
Summary
Add two operations to the existing topology domain, partially addressing #1850.
Operations
topology.simplicial_complex.link.compute— Compute the link of a simplex sigma in a simplicial complex K: all simplices tau such that tau intersect sigma = empty and tau union sigma is a simplex of K. Returns the facets of the link complex.topology.simplicial_complex.f_vector.compute— Compute the f-vector (face counts by dimension), h-vector, and Euler characteristic of a simplicial complex from its maximal facets.Tests
4 link tests covering:
3 f-vector tests covering:
Continue this on Linzumi