/** * <p>Returns a <code>LinkedHashMap</code> which maps each vertex * in the graph (including the <code>source</code> vertex) * to the last edge on the shortest path from the * <code>source</code> vertex. * The map's iterator will return the elements in order of * increasing distance from <code>source</code>.</p> * * @see DijkstraDistance#getDistanceMap(Object,int) * @see DijkstraDistance#getDistance(Object,Object) * @param source the vertex from which distances are measured */ public Map<V,E> getIncomingEdgeMap(V source) { return getIncomingEdgeMap(source, g.getVertexCount()); }
/** * <p>Returns a <code>LinkedHashMap</code> which maps each vertex * in the graph (including the <code>source</code> vertex) * to the last edge on the shortest path from the * <code>source</code> vertex. * The map's iterator will return the elements in order of * increasing distance from <code>source</code>. * * @see DijkstraDistance#getDistanceMap(Object,int) * @see DijkstraDistance#getDistance(Object,Object) * @param source the vertex from which distances are measured */ public Map<V,E> getIncomingEdgeMap(V source) { return getIncomingEdgeMap(source, g.getVertexCount()); }
/** * <p>Returns a <code>LinkedHashMap</code> which maps each vertex * in the graph (including the <code>source</code> vertex) * to its distance from the <code>source</code> vertex. * The map's iterator will return the elements in order of * increasing distance from <code>source</code>.</p> * * <p>The size of the map returned will be the number of * vertices reachable from <code>source</code>.</p> * * @see #getDistanceMap(Object,int) * @see #getDistance(Object,Object) * @param source the vertex from which distances are measured */ public Map<V,Number> getDistanceMap(V source) { return getDistanceMap(source, Math.min(g.getVertexCount(), max_targets)); }
/** * <p> * Returns a <code>LinkedHashMap</code> which maps each vertex in the graph * (including the <code>source</code> vertex) to the last edge on the * shortest path from the <code>source</code> vertex. The map's iterator * will return the elements in order of increasing distance from * <code>source</code>. * </p> * * @see DijkstraDistance#getDistanceMap(Object,int) * @see DijkstraDistance#getDistance(Object,Object) * @param source * the vertex from which distances are measured */ @Override public Map<V, E> getIncomingEdgeMap(V source) { return getIncomingEdgeMap(source, g.getVertexCount()); }
/** * <p>Returns a <code>LinkedHashMap</code> which maps each vertex * in the graph (including the <code>source</code> vertex) * to its distance from the <code>source</code> vertex. * The map's iterator will return the elements in order of * increasing distance from <code>source</code>. * * <p>The size of the map returned will be the number of * vertices reachable from <code>source</code>. * * @see #getDistanceMap(Object,int) * @see #getDistance(Object,Object) * @param source the vertex from which distances are measured * @return a mapping from each vertex in the graph to its distance from {@code source} */ public Map<V,Number> getDistanceMap(V source) { return getDistanceMap(source, Math.min(g.getVertexCount(), max_targets)); }
/** * <p> * Returns a <code>LinkedHashMap</code> which maps each vertex in the graph * (including the <code>source</code> vertex) to its distance from the * <code>source</code> vertex. The map's iterator will return the elements * in order of increasing distance from <code>source</code>. * </p> * * <p> * The size of the map returned will be the number of vertices reachable * from <code>source</code>. * </p> * * @see #getDistanceMap(Object,int) * @see #getDistance(Object,Object) * @param source * the vertex from which distances are measured */ @Override public Map<V, Number> getDistanceMap(V source) { return getDistanceMap(source, Math.min(g.getVertexCount(), max_targets)); }
/** * Returns a {@code Map} from each element {@code t} of {@code targets} to * the shortest-path distance from {@code source} to {@code t}. */ public Map<V, Number> getDistanceMap(V source, Collection<V> targets) { if (g.containsVertex(source) == false) { throw new IllegalArgumentException("Specified source vertex " + source + " is not part of graph " + g); } if (targets.size() > max_targets) { throw new IllegalArgumentException( "size of target set exceeds maximum " + "number of targets allowed: " + this.max_targets); } Map<V, Number> distanceMap = singleSourceShortestPath(source, targets, Math.min(g.getVertexCount(), max_targets)); if (!cached) { reset(source); } return distanceMap; }
/** * Returns a {@code Map} from each element {@code t} of {@code targets} to the * shortest-path distance from {@code source} to {@code t}. */ public Map<V,Number> getDistanceMap(V source, Collection<V> targets) { if (g.containsVertex(source) == false) throw new IllegalArgumentException("Specified source vertex " + source + " is not part of graph " + g); if (targets.size() > max_targets) throw new IllegalArgumentException("size of target set exceeds maximum " + "number of targets allowed: " + this.max_targets); Map<V,Number> distanceMap = singleSourceShortestPath(source, targets, Math.min(g.getVertexCount(), max_targets)); if (!cached) reset(source); return distanceMap; }
/** * Returns a {@code Map} from each element {@code t} of {@code targets} to the * shortest-path distance from {@code source} to {@code t}. * @param source the vertex from which the distance to each target is to be measured * @param targets the vertices to which the distance from the source is to be measured * @return {@code Map} from each element of {@code targets} to its distance from {@code source} */ public Map<V,Number> getDistanceMap(V source, Collection<V> targets) { if (g.containsVertex(source) == false) throw new IllegalArgumentException("Specified source vertex " + source + " is not part of graph " + g); if (targets.size() > max_targets) throw new IllegalArgumentException("size of target set exceeds maximum " + "number of targets allowed: " + this.max_targets); Map<V,Number> distanceMap = singleSourceShortestPath(source, targets, Math.min(g.getVertexCount(), max_targets)); if (!cached) reset(source); return distanceMap; }
throw new IllegalArgumentException("Both sources and sinks (grounds) must be defined"); if (source_voltages.size() + sinks.size() > graph.getVertexCount()) throw new IllegalArgumentException("Source/sink sets overlap, or contain vertices not in graph");
throw new IllegalArgumentException("Both sources and sinks (grounds) must be defined"); if (source_voltages.size() + sinks.size() > graph.getVertexCount()) throw new IllegalArgumentException("Source/sink sets overlap, or contain vertices not in graph");
targets.add(target); if (spath == true) { singleSourceShortestPath(source, targets, g.getVertexCount()); } else { singleSourceMaxThroughputPath(source, targets, g.getVertexCount());
if (source_voltages.size() + sinks.size() > graph.getVertexCount()) { throw new IllegalArgumentException( "Source/sink sets overlap, or contain vertices not in graph");
singleSourceShortestPath(source, targets, g.getVertexCount()); Map<V, E> incomingEdges = ((SourcePathData) sourceMap .get(source)).incomingEdges;
/** * <p>Returns the last edge on a shortest path from <code>source</code> * to <code>target</code>, or null if <code>target</code> is not * reachable from <code>source</code>.</p> * * <p>If either vertex is not in the graph for which this instance * was created, throws <code>IllegalArgumentException</code>.</p> */ public E getIncomingEdge(V source, V target) { if (!g.containsVertex(source)) throw new IllegalArgumentException("Specified source vertex " + source + " is not part of graph " + g); if (!g.containsVertex(target)) throw new IllegalArgumentException("Specified target vertex " + target + " is not part of graph " + g); Set<V> targets = new HashSet<V>(); targets.add(target); singleSourceShortestPath(source, targets, g.getVertexCount()); Map<V,E> incomingEdgeMap = ((SourcePathData)sourceMap.get(source)).incomingEdges; E incomingEdge = incomingEdgeMap.get(target); if (!cached) reset(source); return incomingEdge; }
if (numDests < 1 || numDests > g.getVertexCount()) { throw new IllegalArgumentException( "numDests must be >= 1 " + "and <= g.numVertices()");
singleSourceShortestPath(source, targets, g.getVertexCount()); Map<V, E> incomingEdgeMap = ((SourcePathData) sourceMap .get(source)).incomingEdges;
source + " is not part of graph " + g); if (numDests < 1 || numDests > g.getVertexCount()) throw new IllegalArgumentException("numDests must be >= 1 " + "and <= g.numVertices()");
source + " is not part of graph " + g); if (numDests < 1 || numDests > g.getVertexCount()) throw new IllegalArgumentException("numDests must be >= 1 " + "and <= g.numVertices()");
singleSourceShortestPath(source, targets, g.getVertexCount()); @SuppressWarnings("unchecked") Map<V,E> incomingEdgeMap =