Skip to content

Fix gabriel_graph#183

Merged
yu-ta-sato merged 1 commit into
c2g-dev:mainfrom
yu-ta-sato:fix/gabriel_graph
Jul 4, 2026
Merged

Fix gabriel_graph#183
yu-ta-sato merged 1 commit into
c2g-dev:mainfrom
yu-ta-sato:fix/gabriel_graph

Conversation

@yu-ta-sato

Copy link
Copy Markdown
Collaborator

Description

This pull request fixes the Gabriel graph edge filtering logic in city2graph.proximity.gabriel_graph.

Previously, the implementation tested whether points fell inside the disc with diameter uv by computing distances from each point to the midpoint of the candidate edge. With large projected-coordinate values, this midpoint/radius comparison could become numerically fragile and incorrectly drop valid Gabriel edges.

The fix replaces that predicate with an equivalent dot-product test:

  • a third point lies strictly inside the open Gabriel disc for edge (u, v) iff
    dot(u - w, v - w) < 0
  • candidate Delaunay edges are kept only when no point satisfies that condition

The docstring was also updated to describe the open-disc definition explicitly.

A regression test was added using large projected-CRS-like coordinates. The test verifies that:

  • gabriel_graph matches a brute-force Gabriel graph definition
  • the expected graph hierarchy holds: MST ⊆ RNG ⊆ Gabriel ⊆ Delaunay

Related Issues

N/A

Checklist

  • I have read the Contributing Guide.
  • I have updated the documentation, if necessary.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Pre-commit checks passed locally.

@yu-ta-sato yu-ta-sato merged commit 25cab71 into c2g-dev:main Jul 4, 2026
6 checks passed
@yu-ta-sato yu-ta-sato deleted the fix/gabriel_graph branch July 4, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant