Aggiunti alcuni esercizi
This commit is contained in:
@@ -5,11 +5,11 @@ import position.NodePositionList;
|
||||
import position.Position;
|
||||
import position.PositionList;
|
||||
|
||||
/** Class specializing DFS to find a path between a start vertex and a target
|
||||
/** Class specializing DFS to find a path between a start_static_methods vertex and a target
|
||||
* vertex. It assumes the target vertex is passed as the info object to the
|
||||
* execute method. It returns an iterable list of the vertices and edges
|
||||
* comprising the path from start to info. The returned path is empty if
|
||||
* info is unreachable from start. */
|
||||
* comprising the path from start_static_methods to info. The returned path is empty if
|
||||
* info is unreachable from start_static_methods. */
|
||||
public class FindPathDFS<V, E>
|
||||
extends DFS<V, E, Vertex<V>, Iterable<Position>> {
|
||||
protected PositionList<Position> path;
|
||||
@@ -27,7 +27,7 @@ public class FindPathDFS<V, E>
|
||||
}
|
||||
protected void finishVisit(Vertex<V> v) {
|
||||
path.remove(path.last()); // remove v from path
|
||||
if(!path.isEmpty()) // if v is not the start vertex
|
||||
if(!path.isEmpty()) // if v is not the start_static_methods vertex
|
||||
path.remove(path.last()); // remove discovery edge into v from path
|
||||
}
|
||||
protected void traverseDiscovery(Edge<E> e, Vertex<V> from) {
|
||||
|
||||
Reference in New Issue
Block a user