backbone should be done

graph
Jozef Jankaj 2021-05-02 19:50:28 +02:00
parent b39780a2f5
commit e92c291e57
3 changed files with 25 additions and 9 deletions

View File

@ -1,6 +0,0 @@
package graph;
public class Edge<T> {
Node<T> node1;
Node<T> node2;
}

View File

@ -1,4 +1,11 @@
package graph;
public class Graph {
import java.util.List;
public abstract class Graph {
protected List<Node> nodes;
public List<Node> getAllNodes() {
return nodes;
}
}

View File

@ -1,5 +1,20 @@
package graph;
public class Node<T> {
T item;
import java.util.List;
public abstract class Node {
private final String item;
private List<Node> children;
public Node(String item) {
this.item = item;
}
public String getItem() {
return item;
}
public List<Node> getChildren() {
return children;
}
}