feat(core): integrate ternary-graph route module — RoomGraph for room routing, communities & topology analysis#5
Closed
SuperInstance wants to merge 1 commit into
Closed
Conversation
Add RoomGraph — a ternary-weighted graph-based routing engine for pincher-core that gives rooms actual pathfinding, community detection, and topology analysis. Adds: - pincher-core/src/route/mod.rs: RoomGraph type with trusted/blocked routes, shortest paths (Bellman-Ford), all-pairs (Floyd-Warshall), next-hop routing, label propagation communities, spectral clustering, signed modularity, trusted components, Laplacian/adjacency/degree matrix access - ternary-graph dependency to pincher-core/Cargo.toml - pub mod route registration in pincher-core/src/lib.rs The ternary-graph crate provides zero-dependency, forbid(unsafe_code) signed graph algorithms. This integration gives pincher a mathematically sound foundation for room routing — positive edges mean trusted paths, negative edges mean blocked/adversarial connections. Build: cargo check -p pincher-core — clean Tests: 140 passed (129 existing + 11 new route tests), 0 failed Part of the Phase 1 integration roadmap — validates the ternary ecosystem composability thesis.
SuperInstance
commented
Jun 5, 2026
Owner
Author
SuperInstance
left a comment
There was a problem hiding this comment.
This PR is superseded by #7 (integrate-ternary-types) which takes a more aligned approach: using ternary-types as the lightweight shim crate rather than the full ternary-graph external dependency. The route module in #7 provides the same RoomGraph, pathfinding, and community detection functionality inline.
Closing this PR — the functionality is delivered via the superior architecture.
Owner
Author
|
Superseded by PR #7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
RoomGraphgives pincher actual pathfinding — rooms aren't just piles of data anymore. This PR integrates theternary-graphcrate (zero-dependency,#![forbid(unsafe_code)]) intopincher-coreas theroutemodule.What's Added
New module:
pincher-core/src/route/mod.rs— aRoomGraphwrapper over the ternary-weighted graph substrate:Pathfinding
distances_from()— Bellman-Ford shortest paths (handles negative edges)all_distances()— all-pairs via Floyd-Warshallroute_cost()— single-pair shortest pathnext_hop()— cheapest forward-progress neighborCommunity Detection
detect_communities()— label propagation (positive edges attract, negative repel)cluster_rooms()— spectral clustering via power iteration on signed Laplaciancommunity_modularity()— signed modularity scoringTopology Analysis
trusted_components()— connected components over positive (trusted) edges onlydegree(),adjacency(),laplacian(),normalized_laplacian(),degree_matrix()Factory
build_routing_graph()— quick construction from room name slicesWhy This Matters
Room relationships in PincherOS are naturally ternary: trusted (+1), adversarial (-1), or neutral (0). The ternary-graph ecosystem models this directly, giving us:
Build & Test Results
140 tests pass (129 pre-existing + 11 new route module tests). Zero regressions.
Phase 1 Roadmap Progress
This advances the ternary integration roadmap steps:
Notes
ternary-graphv0.1.0 at commitfdf1355e— zero transitive dependencies, zero risk of version conflictsignoreto avoid requiring network access for doctest fetching