Repository navigation
Add EdgesBetween and viz.FromQuery, support IN filters, revise docs and CI - #4
Merged
Merged
Conversation
Document PoolSize, WAL, the viz subpackage, UpdateNode label replacement, partial writes inside a Tx, query result contents, supported operators, and BreadthFirst trade-offs. Remove claims that the hop cap is configurable and that the module has one dependency. Add Return and BreadthFirst benchmark results. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
Both operators were allowed but compiled to "x IN ?", which SQLite rejects. They now take a slice, bound as one JSON array and read with json_each, so the SQL text does not change with the list length and the prepared statement cache stays bounded. A property filter casts by the slice element type. A non-slice value is a builder error. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
The test workflow now fails on unformatted files and vets bench/compare, and uses current checkout and setup-go actions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
Echarts identifies graph nodes by id, then name. Without an id it kept only the first node with a given name and attached the edges of the others to it. Nodes now carry their graph ID, and edges link by it. Also gofmt convert.go. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
Query results never set Node.Labels, so viz.NewFromResult put every node in one color category. Labels are opt-in: reading them runs a subquery and decodes a JSON array per node, which made default traversals 30-50% slower. The subquery reads node_labels in primary key order; aggregate ORDER BY built a temp b-tree per node and was slower still. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
EdgesBetween returns the edges whose endpoints are both in a set of
node IDs, optionally filtered by type. It is the only way to read edges
for a query result without raw SQL. The ID and type lists bind as JSON
arrays, and a unary + keeps the planner seeking by source instead of
once per source and target pair.
WithLabels adds labels to whatever fields a query returns, where
Return("labels") replaces them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
NewFromResult needed labels the query had not selected and edges the caller had no API to read. FromQuery runs the query with labels and reads the edges between its nodes. New remains for choosing nodes and edges directly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C
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
INandNOT INfilters now work and take a slice. They used to compile tox IN ?, which SQLite rejects. The slice is sent as one JSON array read withjson_each, so the SQL text stays the same whatever the list length.Return("labels")andQuery.WithLabels()fill inNode.Labels. Labels stay off by default: returning them by default made traversals 30–50% slower.EdgesBetween(ctx, nodeIDs, types...), on bothGraphandTx, returns the edges between a set of nodes. A unary+ontarget_idmakes SQLite seek by source; without it, the plan did one index seek per source and target pair.FromQuery(ctx, db, q, options...)replacesNewFromResult. It runs the query with labels and draws every edge between the result's nodes.BENCHMARKS.md.bench/comparemodule, and uses current action versions.bench/compareuses a rootgo.workinstead of areplacedirective.// Package graphdoc comment.Testing
go vet ./... ./bench/compare/...andgo test -race ./...pass.TestWhereIn,TestEdgesBetween,TestFromQuery,TestRenderDuplicateNames.TestReturnnow covers labels.EXPLAIN QUERY PLANfor the labels subquery andEdgesBetween.🤖 Generated with Claude Code
https://claude.ai/code/session_01YB9owLYxU6NsNuVk2NVc7C