Skip to content

combin · GraphLabeling

8 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.

Worked example

The complete checked program Differentiate exactly and distinguish a cusp's smooth and singular points uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Differentiate exactly and distinguish a cusp's smooth and singular points."""

from noether import Q
from noether.commalg import KahlerDifferentials, PolynomialRing


def main() -> None:
    ring = PolynomialRing(Q, ["x", "y"])
    x, y = ring.generators()
    relation = y**2 - x**3
    cusp = ring.quotient(ring.ideal([relation]))
    omega = cusp.kahler_differentials()

    assert isinstance(omega, KahlerDifferentials)
    dx = omega.differentiate(cusp(x))
    dy = omega.differentiate(cusp(y))
    assert omega.differentiate(cusp(x * y)) == dx * cusp(y) + dy * cusp(x)
    assert omega.differentiate(cusp(relation)).is_zero()

    singular = cusp.cotangent_space_at([0, 0])
    smooth = cusp.cotangent_space_at([1, 1])
    assert singular.embedding_dimension == 2
    assert smooth.embedding_dimension == 1
    assert singular.presentation_matrix == singular.evaluated_jacobian.transpose()

    complex = cusp.cotangent_complex()
    assert complex.codimension == 1
    assert (complex.amplitude.lowest_degree, complex.amplitude.highest_degree) == (-1, 0)
    assert complex.hypothesis.equation_count == 1
    complex.verify()

    print(
        "cusp cotangent dimensions: "
        f"singular={singular.embedding_dimension}, smooth={smooth.embedding_dimension}; "
        "complete-intersection amplitude=[-1,0]"
    )


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/39_kahler_differentials.py.

combin.GraphLabeling

Typed edge and vertex labels.

Detailed contract

Typed edge and vertex labels. Wraps graph_core::Labeling<Py<PyAny>, Py<PyAny>> so Python callers can attach any Python object as a label.

Labels are preserved under Labeling.subgraph and Labeling.transpose.

GraphLabeling(graph: Graph, vertex: Sequence[Any], edge: Sequence[Any])

noether::combin::GraphLabeling · Direct Rust declaration

pub struct GraphLabeling<V, E> { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_acceptance_workload.py:11 · validation/unit/combin/test_acceptance_workload.py:98 · validation/unit/combin/test_graph_facade.py:10 · validation/unit/combin/test_graph_facade.py:58

combin.GraphLabeling.edge_label

The label of edge e (by edge index), or raises IndexError.

Detailed contract

The label of edge e (by edge index), or None if out of range.

(self, edge: int) -> Any

noether::combin::GraphLabeling::edge_label · Direct Rust declaration

pub fn edge_label(&self, e: usize) -> Option<&E>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_acceptance_workload.py:99

combin.GraphLabeling.edge_labels

All edge labels, in edge-index order (matching Graph.edges).

Detailed contract

All edge labels, in edge-index order (matching Graph.edges). list[object].

All edge labels, indexed by edge index (Graph::edges order).

(self) -> list[Any]

noether::combin::GraphLabeling::edge_labels · Direct Rust declaration

pub fn edge_labels(&self) -> &[E]
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_graph_facade.py:57 · validation/unit/combin/test_graph_facade.py:58 · validation/parity/u1_graph_core.py:108 · validation/parity/u1_graph_core.py:121 · validation/parity/u1_graph_core.py:130 · validation/backends/graph/igraph_oracle.py:117

combin.GraphLabeling.set_vertex_label

Set the label of vertex v.

Detailed contract

Set the label of vertex v. Raises IndexError if out of range.

Set the label of vertex v. §Errors GraphError::VertexOutOfRange if v is out of range.

(self, vertex: VertexId, label: Any) -> None

noether::combin::GraphLabeling::set_vertex_label · Direct Rust declaration

pub fn set_vertex_label(&mut self, v: u32, label: V) -> Result<(), GraphError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_acceptance_workload.py:100

combin.GraphLabeling.subgraph

The labeling carried across [Graph.subgraph].

Detailed contract

The labeling carried across [Graph.subgraph].

original is the graph the labeling was built for, sub / vertex_map are the Graph.subgraph outputs. Returns a new GraphLabeling for sub with the surviving labels carried over — the label-preservation guarantee. Raises ValueError on a vertex-map shape mismatch or a stray out-of-range entry.

The labeling carried across Graph::subgraph. vertex_map is the vertex map returned by subgraph (new-vertex i was original vertex vertex_map[i]). sub is that returned subgraph. The result’s vertex labels are the kept vertices’ labels in new-id order; its edge labels are the labels of exactly the surviving edges. §Errors GraphError::LabelCountMismatch if vertex_map does not match sub.order(), or GraphError::VertexOutOfRange if a vertex_map entry exceeds this labeling’s vertex count — i.e. vertex_map did not come from a subgraph of this graph.

(self, original: Graph, subgraph: Graph, vertex_map: Sequence[VertexId]) -> GraphLabeling

noether::combin::GraphLabeling::subgraph · Direct Rust declaration

pub fn subgraph( &self, original: &Graph, sub: &Graph, vertex_map: &[u32], ) -> Result<Labeling<V, E>, GraphError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_graph_facade.py:59 · validation/unit/combin/test_graph_facade.py:60 · validation/parity/u1_graph_core.py:106 · validation/parity/u1_graph_core.py:110 · validation/parity/u1_graph_core.py:286 · validation/parity/u1_graph_core.py:287

combin.GraphLabeling.transpose

The labeling carried across [Graph.transpose].

Detailed contract

The labeling carried across [Graph.transpose]. Vertex ids and edge indices are unchanged by transposition, so this is a clone of self (each label is one Python refcount bump).

The labeling carried across Graph::transpose. Transposition flips edge orientation but neither drops, adds, nor reorders edges — transpose maps edge index i to edge index i. Vertex ids are likewise unchanged. So the transposed labeling is simply a clone of self; the method exists to make the preservation explicit and total.

(self) -> GraphLabeling

noether::combin::GraphLabeling::transpose · Direct Rust declaration

pub fn transpose(&self) -> Labeling<V, E>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: examples/39_kahler_differentials.py:26 · examples/distributed/f2_linear_algebra.py:31 · validation/unit/combin/test_graph_facade.py:51 · validation/unit/commalg/test_power_series_facade.py:347 · validation/unit/commalg/test_quotient_facade.py:162 · validation/unit/infra/test_boundary_properties.py:54

combin.GraphLabeling.vertex_label

The label of vertex v, or raises IndexError if out of range.

Detailed contract

The label of vertex v, or raises IndexError if out of range.

Returns the same Python object that was attached (one Python refcount bump), so identity is preserved across the boundary.

The label of vertex v, or None if v is out of range.

(self, vertex: VertexId) -> Any

noether::combin::GraphLabeling::vertex_label · Direct Rust declaration

pub fn vertex_label(&self, v: u32) -> Option<&V>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_graph_facade.py:63 · validation/unit/combin/test_graph_facade.py:64

combin.GraphLabeling.vertex_labels

All vertex labels, in vertex-id order.

Detailed contract

All vertex labels, in vertex-id order. list[object].

All vertex labels, indexed by vertex id.

(self) -> list[Any]

noether::combin::GraphLabeling::vertex_labels · Direct Rust declaration

pub fn vertex_labels(&self) -> &[V]
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, graph-core, perm-core
GIL attached / bounded

Executable usage: validation/unit/combin/test_acceptance_workload.py:101 · validation/unit/combin/test_graph_facade.py:56 · validation/unit/combin/test_graph_facade.py:58 · validation/unit/combin/test_graph_facade.py:63 · validation/unit/combin/test_graph_facade.py:64 · validation/parity/u1_graph_core.py:108