Skip to content

Add graph_tensor symbolic-to-numeric bridge#121

Open
MesTTo wants to merge 4 commits into
trueagi-io:mainfrom
MesTTo:pr/mork-graph-tensor
Open

Add graph_tensor symbolic-to-numeric bridge#121
MesTTo wants to merge 4 commits into
trueagi-io:mainfrom
MesTTo:pr/mork-graph-tensor

Conversation

@MesTTo

@MesTTo MesTTo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Adds graph_tensor.rs: a symbolic-relation → CSR-adjacency bridge with GNN/analytics ops (2-hop SpGEMM, GCN normalized adjacency, PageRank), behind the opt-in einsum feature.

Every numeric op delegates to the existing linalg crate (Csr::from_edges, Csr::matmul, einsum_auto) — this is the graph-analytics consumer of the linalg einsum/CSR kernels, not a new numeric kernel, and it is distinct from the dense einsum-attention path (tensor_ops). It reuses the term-identity sidecar for the symbol↔dense bijection; the only hand-written numeric code is a 4-line relu. The default build is unaffected.

@MesTTo MesTTo force-pushed the pr/mork-graph-tensor branch from c950f77 to 5ba4f04 Compare July 3, 2026 21:16
MesTTo added 3 commits July 4, 2026 17:54
Adds the thin fact layer over the interning base: FactId liveness via a weight
tombstone (remove_fact tombstones, insert_fact revives the same FactId, the
Lucene "live documents" model), live_fact_count, and facts_by_relation, an index
from a relation head to its facts so a consumer (EGraph::from_equalities,
RelationAdjacency::from_sidecar) scans one relation instead of the whole sidecar.

Deliberately excludes incremental maintenance (prefix staleness watermarks,
delta application, PathMap re-sync scans): incremental maintenance is deferred
project-wide, and PathMap's own shared_node_id COW identity is the right
staleness primitive when it becomes needed, not a value-count watermark.
Replaces the hand-rolled 128-bit FNV in TermIdentitySidecar with the canonical
Expr::hash (gxhash128 over the term's byte span), the same structural hash the
rest of MORK already uses. The hash is only a collision-bucket filter -- exact
encoded bytes are compared before an identity is reused -- so the swap cannot
change which terms share a TermId, on ground or adversarial input. Modeled in
Alloy (fac22_term_identity in MesTTo/alloy-mork): HashSwapPreservesIdentity is
UNSAT. Addresses the maintainer's "reuse, don't reimplement" direction (no bespoke
hash where the crate has one). term_identity (4) and egraph (2) suites pass.
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