Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package INF102.lab5.graph;
import java.util.Set;
public interface IGraph<V> {
/**
* Number of nodes in the graph
* @return number of nodes in graph
*/
public int size();
/**
* Get all nodes in graph
* @return set of graph nodes
*/
public Set<V> getNodes();
/**
* Add <code>node</code> to graph
* @param node
*/
public void addNode(V node);
/**
* Remove <code>node</code> from graph
* @param node
*/
public void removeNode(V node);
/**
* Add edge between node <code>u</code> and <code>v</code>
* @param u
* @param v
* @throws IllegalArgumentException if the nodes given are not in the graph
*/
public void addEdge(V u, V v);
/**
* Remove edge between node <code>u</code> and <code>v</code>
* @param u
* @param v
*/
public void removeEdge(V u, V v);
/**
* Checks if there is a node <code>node</code> in the graph
* @param node
* @return true if node is in graph
*/
public boolean hasNode(V node);
/**
* Checks if there is an edge between node <code>u</code> and <code>v</code>
* @param u
* @param v
* @return true if there is an edge between <code>u</code> and <code>v</code>
*/
public boolean hasEdge(V u, V v);
/**
* Finds all neighbours of node <code>u</code>.
* The neighbours of a node is all nodes which it has an edge to.
* @param node
* @return list of all neighbours
*/
public Set<V> getNeighbourhood(V node);
}