Repository navigation
fix(#6699): algo.wcc applies its relTypes filter - #6700
Conversation
The argument was validated but never reached the traversal: execute() passed
null where the filter belongs, in both findProvider and loadGraph, so every
call returned the whole-graph answer.
Read it with the existing extractRelTypes helper and pass it through, as
AlgoLeiden already does. The direct CSR shortcut is now taken only for an
unfiltered call: connectedComponents() walks the whole view, and a provider is
selected for covering the requested edge types rather than only those, so a
view spanning {A,B} satisfies a request for 'A' and the shortcut would union
edges the caller asked to leave out. A filtered call goes through loadGraph,
which applies relTypes to CSR adjacency, keeping acceleration without widening.
Five tests in AlgoWCCTest cover the filter, an unknown type, comma-separated
types and a view covering more types than requested. Four of them fail without
the change.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesWCC relationship-type filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change applies the requested relationship-type filter to connected-component traversal and adds focused coverage; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
Up to standards ✅🟢 Issues
|
|
Tick the box to add this pull request to the merge queue (same as
|
findProvider(relTypes) already only returns a provider that covers every requested type, and GraphAlgorithms.connectedComponents() already resolves each requested relType to its own CSR index, so a filtered call does not need to give up the parallel min-label propagation path for the single-threaded OLTP BFS. Only an unfiltered call previously kept CSR acceleration; now both do.
|
Thanks @ZwaarContrast ! |
What does this PR do?
Makes
algo.wcc([relTypes])restrict the traversal to the listed edge types.execute()now reads the argument with the existingextractRelTypeshelper and passes it on,following the pattern
AlgoLeidenalready uses:loadGraph(db, null, relTypes, null)in place ofloadGraph(db, null, null, null)graph.adjacency(Vertex.DIRECTION.BOTH, relTypes)in place of the unfiltered overloadThe direct
executeWithCSRshortcut is now taken only for an unfiltered call.GraphAlgorithms.connectedComponents()walks the whole view, and a provider is selected forcovering the requested edge types rather than for covering only those, so a view spanning
{A, B}satisfies a request for'A'and the shortcut would union edges the caller asked toleave out. A filtered call goes through
loadGraph, which appliesrelTypesto CSR adjacencyvia
buildAdjacencyFromProvider, so acceleration is kept without widening the result.Motivation
The filter did not take effect, so the result was the whole-graph answer whatever was passed,
with no error to signal it. Filtering on an edge type with no edges returned one component
containing everything, where each vertex should have been on its own.
Related issues
Fixes #6699.
For context, related
relTypeswork elsewhere in the package: #4287 / #4360(
algo.leiden), #6301 (algo.steinerTree), #6376 (algo.maxKCut). Separate from #6316,which covers procedures that do not resolve a provider at all.
Checklist
mvn clean packagecommandOn the first box: the reactor runs 17,598 tests here with
AlgoWCCTestat 9/0 and the3,897-test
OpenCypherTCKSuiteclean, but it does not finish green in my container. Eachremaining failure was checked separately and none involve this change:
DatabaseGetSizeTest,PromQLEvaluatorIntegrationTestandIssue6440FlushAckOnClosedDatabaseTestfail the same way on an unmodified checkout, andWindowFunctionTest/TimeSeriesFunctionDeltaTestgave 0, 1 and 3 failures across threeidentical runs of the same tree. Happy to re-run anything that would help.
Five tests added to
AlgoWCCTest:wccWithRelTypesRestrictsToThoseEdgeswcc('EDGE'):{A,B,C}share an id,{D,E}share another, the two differwccWithRelTypesIgnoresOtherEdgeTypeswcc('OTHER'):{C,D}together, with A, B and E as three distinct singletonswccWithUnknownRelTypeIsolatesEveryVertexwcc('NOSUCH'): five distinct ids, since that type has no edgeswccWithCommaSeparatedRelTypesCoversBothwcc('EDGE,OTHER'): matches the unfiltered result, covering comma-separated parsingwccWithRelTypesIsNotWidenedByAViewCoveringMoreTypeswcc('EDGE')still separates the two componentsThe existing tests continue to cover the unfiltered call.
Run both ways:
wccWithCommaSeparatedRelTypesCoversBothpasses either way, since'EDGE,OTHER'is every edgetype in the fixture; it guards the separator handling rather than this behaviour. The other four
fail without the change.
Summary by CodeRabbit
New Features
Bug Fixes