graph.getEdgeFactory(), currentStartNode); for (V v : graph.vertexSet()) { Set<E> predEdges = (Set<E>) v.getPredecessorEdges(); for (E e : predEdges) { V source = graph.getEdgeSource(e);
private void addPredEdges(KeyedGraph<VDijkstra, Edge> graph, VDijkstra dest, SimpleResultSet output, Map<Integer, Geometry> edgeGeomMap, int localID) throws SQLException { // Rebuild the shortest path(s). (Yes, there could be more than // one if they have the same distance!) final Set<Edge> predEdges = dest.getPredecessorEdges(); // The only vertex with no predecessors is the source vertex, so we can // start renumbering here. if (predEdges.isEmpty()) { globalID++; } // Recursively add the predecessor edges. for (Edge e : predEdges) { final VDijkstra edgeSource = graph.getEdgeSource(e); final VDijkstra edgeDestination = graph.getEdgeTarget(e); final Geometry geometry = edgeGeomMap.get(Math.abs(e.getID())); // Right order if (edgeDestination.equals(dest)) { output.addRow(geometry, e.getID(), globalID, localID, edgeSource.getID(), edgeDestination.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeSource, output, edgeGeomMap, localID + 1); } // Wrong order else { output.addRow(geometry, e.getID(), globalID, localID, edgeDestination.getID(), edgeSource.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeDestination, output, edgeGeomMap, localID + 1); } } }
private void addPredEdges(KeyedGraph<VDijkstra, Edge> graph, VDijkstra dest, SimpleResultSet output, Map<Integer, Geometry> edgeGeomMap, int localID) throws SQLException { // Rebuild the shortest path(s). (Yes, there could be more than // one if they have the same distance!) final Set<Edge> predEdges = dest.getPredecessorEdges(); // The only vertex with no predecessors is the source vertex, so we can // start renumbering here. if (predEdges.isEmpty()) { globalID++; } // Recursively add the predecessor edges. for (Edge e : predEdges) { final VDijkstra edgeSource = graph.getEdgeSource(e); final VDijkstra edgeDestination = graph.getEdgeTarget(e); final Geometry geometry = edgeGeomMap.get(Math.abs(e.getID())); // Right order if (edgeDestination.equals(dest)) { output.addRow(geometry, e.getID(), globalID, localID, edgeSource.getID(), edgeDestination.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeSource, output, edgeGeomMap, localID + 1); } // Wrong order else { output.addRow(geometry, e.getID(), globalID, localID, edgeDestination.getID(), edgeSource.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeDestination, output, edgeGeomMap, localID + 1); } } }
private void addPredEdges(KeyedGraph<VDijkstra, Edge> graph, VDijkstra dest, SimpleResultSet output, Map<Integer, Geometry> edgeGeomMap, int localID) throws SQLException { // Rebuild the shortest path(s). (Yes, there could be more than // one if they have the same distance!) final Set<Edge> predEdges = dest.getPredecessorEdges(); // The only vertex with no predecessors is the source vertex, so we can // start renumbering here. if (predEdges.isEmpty()) { globalID++; } // Recursively add the predecessor edges. for (Edge e : predEdges) { final VDijkstra edgeSource = graph.getEdgeSource(e); final VDijkstra edgeDestination = graph.getEdgeTarget(e); final Geometry geometry = edgeGeomMap.get(Math.abs(e.getID())); // Right order if (edgeDestination.equals(dest)) { output.addRow(geometry, e.getID(), globalID, localID, edgeSource.getID(), edgeDestination.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeSource, output, edgeGeomMap, localID + 1); } // Wrong order else { output.addRow(geometry, e.getID(), globalID, localID, edgeDestination.getID(), edgeSource.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeDestination, output, edgeGeomMap, localID + 1); } } }
private void addPredEdges(KeyedGraph<VDijkstra, Edge> graph, VDijkstra dest, SimpleResultSet output, int localID) throws SQLException { // Rebuild the shortest path(s). (Yes, there could be more than // one if they have the same distance!) final Set<Edge> predEdges = dest.getPredecessorEdges(); // The only vertex with no predecessors is the source vertex, so we can // start renumbering here. if (predEdges.isEmpty()) { globalID++; } // Recursively add the predecessor edges. for (Edge e : predEdges) { final VDijkstra edgeSource = graph.getEdgeSource(e); final VDijkstra edgeDestination = graph.getEdgeTarget(e); // Right order if (edgeDestination.equals(dest)) { output.addRow(e.getID(), globalID, localID, edgeSource.getID(), edgeDestination.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeSource, output, localID + 1); } // Wrong order else { output.addRow(e.getID(), globalID, localID, edgeDestination.getID(), edgeSource.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeDestination, output, localID + 1); } } }
private void addPredEdges(KeyedGraph<VDijkstra, Edge> graph, VDijkstra dest, SimpleResultSet output, int localID) throws SQLException { // Rebuild the shortest path(s). (Yes, there could be more than // one if they have the same distance!) final Set<Edge> predEdges = dest.getPredecessorEdges(); // The only vertex with no predecessors is the source vertex, so we can // start renumbering here. if (predEdges.isEmpty()) { globalID++; } // Recursively add the predecessor edges. for (Edge e : predEdges) { final VDijkstra edgeSource = graph.getEdgeSource(e); final VDijkstra edgeDestination = graph.getEdgeTarget(e); // Right order if (edgeDestination.equals(dest)) { output.addRow(e.getID(), globalID, localID, edgeSource.getID(), edgeDestination.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeSource, output, localID + 1); } // Wrong order else { output.addRow(e.getID(), globalID, localID, edgeDestination.getID(), edgeSource.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeDestination, output, localID + 1); } } }
private void addPredEdges(KeyedGraph<VDijkstra, Edge> graph, VDijkstra dest, SimpleResultSet output, int localID) throws SQLException { // Rebuild the shortest path(s). (Yes, there could be more than // one if they have the same distance!) final Set<Edge> predEdges = dest.getPredecessorEdges(); // The only vertex with no predecessors is the source vertex, so we can // start renumbering here. if (predEdges.isEmpty()) { globalID++; } // Recursively add the predecessor edges. for (Edge e : predEdges) { final VDijkstra edgeSource = graph.getEdgeSource(e); final VDijkstra edgeDestination = graph.getEdgeTarget(e); // Right order if (edgeDestination.equals(dest)) { output.addRow(e.getID(), globalID, localID, edgeSource.getID(), edgeDestination.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeSource, output, localID + 1); } // Wrong order else { output.addRow(e.getID(), globalID, localID, edgeDestination.getID(), edgeSource.getID(), graph.getEdgeWeight(e)); addPredEdges(graph, edgeDestination, output, localID + 1); } } }