piccola variazione a adjacency list
This commit is contained in:
@@ -67,8 +67,7 @@ public class AdjacencyListGraph<V,E> implements Graph<V,E> {
|
||||
}
|
||||
|
||||
// Return the other endvertex of an incident edge
|
||||
public Vertex<V> opposite(Vertex<V> v, Edge<E> e)
|
||||
throws InvalidPositionException {
|
||||
public Vertex<V> opposite(Vertex<V> v, Edge<E> e) throws InvalidPositionException {
|
||||
checkVertex(v);
|
||||
MyEdge<E> ee = checkEdge(e);
|
||||
Vertex<V>[] endv = ee.endVertices();
|
||||
@@ -81,8 +80,7 @@ public class AdjacencyListGraph<V,E> implements Graph<V,E> {
|
||||
}
|
||||
|
||||
// Test whether two vertices are adjacent
|
||||
public boolean areAdjacent(Vertex<V> u, Vertex<V> v)
|
||||
throws InvalidPositionException {
|
||||
public boolean areAdjacent(Vertex<V> u, Vertex<V> v) throws InvalidPositionException {
|
||||
// search the incidence list of the vertex with smaller degree
|
||||
Iterable<Edge<E>> iterToSearch;
|
||||
if (degree(u) < degree(v)) {
|
||||
@@ -110,8 +108,7 @@ public class AdjacencyListGraph<V,E> implements Graph<V,E> {
|
||||
}
|
||||
|
||||
// Insert and return a new edge with a given element between two vertices
|
||||
public Edge<E> insertEdge(Vertex<V> v, Vertex<V> w, E o)
|
||||
throws InvalidPositionException {
|
||||
public Edge<E> insertEdge(Vertex<V> v, Vertex<V> w, E o) throws InvalidPositionException {
|
||||
MyVertex<V> vv = checkVertex(v);
|
||||
MyVertex<V> ww = checkVertex(w);
|
||||
MyEdge<E> ee = new MyEdge<E>(v, w, o);
|
||||
|
||||
Reference in New Issue
Block a user