use of org.neo4j.graphalgo.impl.util.PathImpl in project neo4j by neo4j.
the class ShortestPath method hitsToPaths.
private static Collection<Path> hitsToPaths(EvaluationContext context, Collection<Hit> depthHits, Node start, Node end, boolean stopAsap, int maxResultCount, MemoryTracker memoryTracker) {
Set<Path> paths = HeapTrackingCollections.newSet(memoryTracker);
for (Hit hit : depthHits) {
for (PathImpl path : hitToPaths(context, hit, start, end, stopAsap)) {
memoryTracker.allocateHeap(path.estimatedHeapUsage());
paths.add(path);
if (paths.size() >= maxResultCount) {
break;
}
}
}
return paths;
}
use of org.neo4j.graphalgo.impl.util.PathImpl in project neo4j by neo4j.
the class ShortestPath method hitToPaths.
private static Collection<PathImpl> hitToPaths(EvaluationContext context, Hit hit, Node start, Node end, boolean stopAsap) {
Collection<PathImpl> paths = new ArrayList<>();
Iterable<List<Relationship>> startPaths = getPaths(context, hit.connectingNode, hit.start, stopAsap);
Iterable<List<Relationship>> endPaths = getPaths(context, hit.connectingNode, hit.end, stopAsap);
for (List<Relationship> startPath : startPaths) {
PathImpl.Builder startBuilder = toBuilder(start, startPath);
for (List<Relationship> endPath : endPaths) {
PathImpl.Builder endBuilder = toBuilder(end, endPath);
PathImpl path = startBuilder.build(endBuilder);
paths.add(path);
}
}
return paths;
}
Aggregations