neuralqx.graph.core.utils.sign_utils package

class NonplanarSigns(handler, *, tol=1e-14, seed=None)

Bases: object

Compute \(\varepsilon\) sign tables at all vertices of an embedded multi graph.

For each vertex \(v\), each incident edge is assigned a unit tangent direction \(\hat t_e(v)\) in \(\mathbb{R}^3\). For any ordered triple of distinct incident edges \((e_I, e_J, e_K)\), the sign is defined by

\[\begin{split}\varepsilon_v(e_I, e_J, e_K) = \begin{cases} 0, & |\det[\hat t_I\ \hat t_J\ \hat t_K]| \le \text{tol} \\ +1, & \det[\hat t_I\ \hat t_J\ \hat t_K] > \text{tol} \\ -1, & \det[\hat t_I\ \hat t_J\ \hat t_K] < -\text{tol} \end{cases}\end{split}\]

Parallel or duplicated edges can yield identical tangents and therefore non generic tables. To avoid this, edges that share the same endpoint pair are deterministically perturbed at the vertex by rotating the tangent around a randomly chosen axis that is orthogonal to the base tangent. The randomness is deterministic, derived from the edge key and a global seed, so repeated runs are reproducible.

Parameters:
  • handler (GraphHandler) – Graph handler providing node coordinates and edge keys for the embedding.

  • tol (float) – Determinant magnitude tolerance below which the sign is set to zero.

  • seed (int | str | None) – Optional seed controlling deterministic perturbations, may be an int, a string, or None.