-
Notifications
You must be signed in to change notification settings - Fork 28
Add Spliterator on NodesQuadTree #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…in quadtree spliterator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds spliterator support and predicate/approximate querying to the spatial (quadtree) index, introduces multi-node edge iteration, and updates the SpatialIndex API. Also refactors internal quad tree storage from Set to array plus versioning and adjusts configuration defaults (larger capacities).
- Added Node & Edge spliterators (including filtered and approximate variants) and exposed readLock/readUnlock plus approximate query methods in SpatialIndex.
- Reworked quad tree node storage to fixed-size expandable arrays, added versioning and multi-node edge iterators; edge area queries now may return duplicates (tests updated).
- Increased several default storage and spatial index capacity constants.
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| SpatialIndexImplTest.java | Adjusts expectations for edge queries (now allowing duplicate edges) and adds clear test. |
| NodesQuadTreeTest.java | Extensive new tests for counts, iterator/spliterator behavior, predicates, approximate queries, edges, and performance scenarios. |
| GraphGenerator.java | Adds node generation within an optional Rect2D region. |
| EdgeStoreTest.java | Updates iterator calls with new locking flag; adds multi-node edge iterator tests. |
| UndirectedDecorator.java | Adapts to new edge iterator signature with locking flag. |
| SpatialNodeDataImpl.java | Adds array index tracking and clear() helper for quad tree storage. |
| SpatialIndexImpl.java | Refactors to delegate edge/node area queries directly to NodesQuadTree, adds approximate & predicate-aware methods, locking passthrough, object count accessor. |
| NodesQuadTree.java | Major refactor: array-based storage, versioning, predicates, approximate search, edge iteration & spliterators, global edge spliterator, counting APIs. |
| NodeStore.java | Updates edge iterator usage with new signature (locking flag). |
| GraphViewImpl.java | Uses spatial index predicate-based filtering; exposes approximate queries; delegates boundaries computation to spatial index. |
| GraphViewDecorator.java | Adapts view-level area queries to new spatial index methods and iterator signature; simplifies boundary retrieval. |
| GraphStoreConfiguration.java | Increases edge store and spatial index sizing constants; adds config flags for approximate search and iterator threshold. |
| GraphStore.java | Updates iterator calls with new edgeIterator signature. |
| EdgeStore.java | Introduces abstract & multi-node edge iterators; propagates spatial index version bumps; adds iterator/spliterator factory changes. |
| SpatialIndex.java | Expands API (approximate queries, locking methods) and updates documentation (edges may be duplicated). |
| Rect2D.java | Changes toString format and adds containsOrIntersects utility methods. |
Comments suppressed due to low confidence (1)
src/main/java/org/gephi/graph/api/SpatialIndex.java:1
- [nitpick] Exposing explicit readLock()/readUnlock() in the public SpatialIndex API leaks internal locking strategy and invites misuse (e.g., forgotten unlocks). Consider providing higher-level safe streaming helpers or auto-closeable scopes (e.g., try-with-resources) instead, or confine locking to iterator/spliterator implementations.
/*
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Remove distinct from spliterator as edges can be returned twice Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… into 242-spliterator-spatial
This adds the ability to query the quadtree using (parallel) streams.