Skip to content

feat(math): add simplicial complex link and f-vector operations (#1850) - #2025

Open
morluto wants to merge 1 commit into
mainfrom
agent/simplicial-complexes-1850
Open

feat(math): add simplicial complex link and f-vector operations (#1850)#2025
morluto wants to merge 1 commit into
mainfrom
agent/simplicial-complexes-1850

Conversation

@morluto

@morluto morluto commented Aug 18, 2026

Copy link
Copy Markdown
Owner

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:

  • Link of a vertex in a triangle (returns edge)
  • Link of an edge in a triangle (returns vertex)
  • Link in a discrete complex (empty)
  • Link in a boundary (multiple components)

3 f-vector tests covering:

  • Triangle, edge, and single vertex

Continue this on Linzumi

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.
@morluto morluto added feature epic: execute Execute: math.run honesty, results, verify path domain: topology Topology, homology, and cohomology request: math-operation Request to add or extend a user-facing mathematical operation labels Aug 18, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto morluto left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

morluto commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

Deep review summary

Verdict: REQUEST CHANGES — both newly advertised invariants are incorrect or under-validated.

1. The h-vector repeats PR #2022's indexing bug

The implementation treats (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 checks only f-vector and Euler values.

2. LinkRequest does not require the input to be a simplex

It checks only that each vertex occurs somewhere in the complex. For 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 represents the request.

Require unique simplex vertices and require frozenset(simplex) to belong to the face closure. Also distinguish the link {∅} of a maximal facet from the void complex; both are currently collapsed to link_is_empty=True even though they are not the same simplicial complex.

This PR duplicates #2022's operation ID, schema, and implementation while adding link support. They should not both merge; keep one corrected implementation or split link support into a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: topology Topology, homology, and cohomology epic: execute Execute: math.run honesty, results, verify path feature request: math-operation Request to add or extend a user-facing mathematical operation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant