Adding in change to Edge Node to GraphNode and making a GraphNode interface to the Node class, as we don't need the other memebers of Generic Node for a Graph Node in this case
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
public class Edge {
|
public class Edge {
|
||||||
Node source;
|
GraphNode source;
|
||||||
Node destination;
|
GraphNode destination;
|
||||||
int weight;
|
int weight;
|
||||||
|
|
||||||
public Edge(Node source, Node destination, int weight) {
|
public Edge(Node source, Node destination, int weight) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
interface GraphNode {
|
interface GraphNode {
|
||||||
String name = "";
|
String name = "";
|
||||||
List<Edge> edges = new ArrayList<Edge>();
|
List<Edge> edges = new ArrayList<Edge>();
|
||||||
|
String getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Node implements GraphNode {
|
public class Node implements GraphNode {
|
||||||
|
|||||||
Reference in New Issue
Block a user