Skip to content

Infer edge connections from graph exploration#1742

Merged
kmcginnes merged 1 commit intoaws:mainfrom
kmcginnes:infer-edge-connections-from-exploration
May 4, 2026
Merged

Infer edge connections from graph exploration#1742
kmcginnes merged 1 commit intoaws:mainfrom
kmcginnes:infer-edge-connections-from-exploration

Conversation

@kmcginnes
Copy link
Copy Markdown
Collaborator

@kmcginnes kmcginnes commented Apr 30, 2026

Description

When users explore the graph and edges are returned from queries, the edge types are correctly added to the schema, but the edge connections (source vertex type → edge type → target vertex type) are not inferred. This means the Schema Explorer diagram does not show new relationships discovered through exploration until the database summary API catches up.

  • Add required vertexLookup parameter to updateSchemaFromEntities to infer EdgeConnection entries from edges and their endpoint vertex types
  • New VertexTypeLookup interface with createVertexTypeLookup factory that chains existing Map<VertexId, Vertex> instances with O(1) construction (no copying)
  • New mergeEdgeConnections function handles multi-label vertices, deduplication, and preserves existing connections (including their count)
  • New createEdgeConnection helper for constructing EdgeConnection objects from plain strings
  • Update call sites (useAddToGraph, useUpdateSchemaFromEntities, FakeExplorer) to build and pass the vertex lookup from the entity batch + canvas state, with batch vertices taking priority
  • Schema refresh continues to overwrite edge connections entirely (current behavior preserved)

Validation

  • 7 unit tests for edge connection inference (basic, multi-label, unresolvable endpoints, dedup, count preservation, referential equality)
  • 6 tests for createVertexTypeLookup (chaining, priority, isEmpty, unknown IDs)
  • 5 integration tests through useAddToGraph and useUpdateSchemaFromEntities verifying end-to-end inference and batch-over-canvas priority
  • All 153 test files pass (1678 tests)
  • pnpm checks passes (lint, format, types)

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

@kmcginnes kmcginnes force-pushed the infer-edge-connections-from-exploration branch 7 times, most recently from 9fd75d0 to d9208c2 Compare May 1, 2026 20:49
@kmcginnes kmcginnes marked this pull request as ready for review May 1, 2026 23:03
Copy link
Copy Markdown
Contributor

@acarbonetto acarbonetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor and code looks good. Please fix conflicts.

nit: there's a couple of cases where we could add tests for the empty/null case, but I don't think this is very important.

updateSchemaFromEntities now accepts an optional vertexLookup parameter
to infer EdgeConnection entries from edges and their endpoint vertex
types. This makes the Schema Explorer show relationships discovered
through exploration without waiting for the database summary API.

Closes aws#1720
@kmcginnes kmcginnes force-pushed the infer-edge-connections-from-exploration branch from d9208c2 to 59b7c8b Compare May 4, 2026 19:34
@kmcginnes kmcginnes merged commit 5d337fd into aws:main May 4, 2026
2 of 3 checks passed
@kmcginnes kmcginnes deleted the infer-edge-connections-from-exploration branch May 4, 2026 20:45
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.

Schema Explorer missing edge connections inferred from graph exploration

3 participants