Fixato bug e implementato alcune funzioni.

This commit is contained in:
2014-06-01 18:16:43 +02:00
parent 015d8cac76
commit e53f98a3a8
31 changed files with 910 additions and 151 deletions

View File

@@ -2,7 +2,7 @@
package graph;
import java.security.InvalidKeyException;
import exceptions.InvalidKeyException;
public class ComponentsBFS<V, E> extends BFS<V, E, Object, Integer> {
protected Integer compNumber;
@@ -13,16 +13,11 @@ public class ComponentsBFS<V, E> extends BFS<V, E, Object, Integer> {
}
protected void startVisit(Vertex<V> v) {
try {
v.put(COMPONENT, compNumber);
}
catch (InvalidKeyException e){
}
}
protected Integer finalResult(Integer bfsResult) {
try {
for(Vertex<V> v : graph.vertices())
if(!isVisited(v)) {
compNumber++;
@@ -30,10 +25,5 @@ public class ComponentsBFS<V, E> extends BFS<V, E, Object, Integer> {
}
return compNumber;
}
catch (InvalidKeyException e){
}
return null;
}
}