1
+ import java .util .Vector ;
2
+
3
+ public interface Graph
4
+ {
5
+ // Set the cost interval of the graph. NOTE: Also implement this functionality
6
+ // into the constructor of the Graph class
7
+ void setCostInterval (Double low , Double high );
8
+
9
+ // Get the low cost interval for this graph.
10
+ // Throw a NullPointerException if this has not been set.
11
+ Double getLowCostInterval ();
12
+
13
+ // Get the high cost interval for this graph.
14
+ // Throw a NullPointerException if this has not been set.
15
+ Double getHighCostInterval ();
16
+
17
+ // Join two graphs IF they have the same cost interval and disjointed set of
18
+ // nodes. Throw IllegalArgumentException w/ text if these aren't met.
19
+ Graph joinGraph (Graph obj );
20
+
21
+ // Calculate the path between two given nodes. If no path can be found,
22
+ // return null. Throw IllegalArgumentException if nodes are not in graph.
23
+ Path calculatePath (Node from , Node to );
24
+
25
+ // Determines if a path exists between the two given nodes
26
+ // Throws IllegalArgumentException if nodes don't exist in the graph.
27
+ Boolean pathExists (Node from , Node to );
28
+
29
+ // Return shortest path between two nodes.
30
+ // Throw IllegalArgumentException if nodes don't exist in the graph.
31
+ Double pathDistance (Node from , Node to );
32
+
33
+ // Add an edge to the graph. Add nodes to graph if they don't already exist.
34
+ // Throw IllegalArgumentException if triangle inequality is violated.
35
+ void addEdge (String fromNode , String toNode , Double cost );
36
+
37
+ // Does the graph contain the given Node?
38
+ boolean hasNode (String label );
39
+
40
+ // Get the node that has the given label
41
+ Node getNode (String label );
42
+
43
+ // Adds a node to this graph with the given label
44
+ void addNode (String label );
45
+
46
+ // Returns all the edges that this graph contains
47
+ Vector <Edge > getEdges ();
48
+
49
+ // Returns all the nodes associated with this graph
50
+ Vector <Node > getNodes ();
51
+ }
0 commit comments