protected void findPathsSetIntersection(FindPathOptions options, List<Path> foundPaths, Vertex sourceVertex, Vertex destVertex, ProgressCallback progressCallback, Authorizations authorizations) { String sourceVertexId = sourceVertex.getId(); String destVertexId = destVertex.getId(); progressCallback.progress(0.1, ProgressCallback.Step.SEARCHING_SOURCE_VERTEX_EDGES); Set<String> sourceVertexConnectedVertexIds = filterFindPathEdgeInfo(options, sourceVertex.getEdgeInfos(Direction.BOTH, options.getLabels(), authorizations)); Map<String, Boolean> sourceVerticesExist = doVerticesExist(sourceVertexConnectedVertexIds, authorizations); sourceVertexConnectedVertexIds = stream(sourceVerticesExist.keySet()) .filter(key -> sourceVerticesExist.getOrDefault(key, false)) .collect(Collectors.toSet()); progressCallback.progress(0.3, ProgressCallback.Step.SEARCHING_DESTINATION_VERTEX_EDGES); Set<String> destVertexConnectedVertexIds = filterFindPathEdgeInfo(options, destVertex.getEdgeInfos(Direction.BOTH, options.getLabels(), authorizations)); Map<String, Boolean> destVerticesExist = doVerticesExist(destVertexConnectedVertexIds, authorizations); destVertexConnectedVertexIds = stream(destVerticesExist.keySet()) .filter(key -> destVerticesExist.getOrDefault(key, false)) .collect(Collectors.toSet()); if (sourceVertexConnectedVertexIds.contains(destVertexId)) { foundPaths.add(new Path(sourceVertexId, destVertexId)); if (options.isGetAnyPath()) { return; } } progressCallback.progress(0.6, ProgressCallback.Step.MERGING_EDGES); sourceVertexConnectedVertexIds.retainAll(destVertexConnectedVertexIds); progressCallback.progress(0.9, ProgressCallback.Step.ADDING_PATHS); for (String connectedVertexId : sourceVertexConnectedVertexIds) { foundPaths.add(new Path(sourceVertexId, connectedVertexId, destVertexId)); } }
protected void findPathsSetIntersection(FindPathOptions options, List<Path> foundPaths, Vertex sourceVertex, Vertex destVertex, ProgressCallback progressCallback, Authorizations authorizations) { String sourceVertexId = sourceVertex.getId(); String destVertexId = destVertex.getId(); progressCallback.progress(0.1, ProgressCallback.Step.SEARCHING_SOURCE_VERTEX_EDGES); Set<String> sourceVertexConnectedVertexIds = filterFindPathEdgeInfo(options, sourceVertex.getEdgeInfos(Direction.BOTH, options.getLabels(), authorizations)); Map<String, Boolean> sourceVerticesExist = doVerticesExist(sourceVertexConnectedVertexIds, authorizations); sourceVertexConnectedVertexIds = stream(sourceVerticesExist.keySet()) .filter(key -> sourceVerticesExist.getOrDefault(key, false)) .collect(Collectors.toSet()); progressCallback.progress(0.3, ProgressCallback.Step.SEARCHING_DESTINATION_VERTEX_EDGES); Set<String> destVertexConnectedVertexIds = filterFindPathEdgeInfo(options, destVertex.getEdgeInfos(Direction.BOTH, options.getLabels(), authorizations)); Map<String, Boolean> destVerticesExist = doVerticesExist(destVertexConnectedVertexIds, authorizations); destVertexConnectedVertexIds = stream(destVerticesExist.keySet()) .filter(key -> destVerticesExist.getOrDefault(key, false)) .collect(Collectors.toSet()); if (sourceVertexConnectedVertexIds.contains(destVertexId)) { foundPaths.add(new Path(sourceVertexId, destVertexId)); if (options.isGetAnyPath()) { return; } } progressCallback.progress(0.6, ProgressCallback.Step.MERGING_EDGES); sourceVertexConnectedVertexIds.retainAll(destVertexConnectedVertexIds); progressCallback.progress(0.9, ProgressCallback.Step.ADDING_PATHS); for (String connectedVertexId : sourceVertexConnectedVertexIds) { foundPaths.add(new Path(sourceVertexId, connectedVertexId, destVertexId)); } }