Skip to content
Snippets Groups Projects
Commit 328707b7 authored by Sören Henning's avatar Sören Henning
Browse files

work on nested graph library

parent 74630717
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
...@@ -12,9 +12,28 @@ public class GraphTester { ...@@ -12,9 +12,28 @@ public class GraphTester {
Vertex node2 = graph.addVertex("n2"); Vertex node2 = graph.addVertex("n2");
Graph subgraph = node1.addChildGraph(); Vertex node3 = graph.addVertex("n3");
Vertex node11 = subgraph.addVertex("n1::n1"); Vertex node4 = graph.addVertex("n4");
Edge edge12 = node1.addEdge(node2);
Edge edge11 = node1.addEdge(node1);
Edge edge23 = node2.addEdge("e23", node3);
graph.addEdge("e13", node1, node3);
Vertex node1snd = graph.getVertex("n1");
assert node1 == node1snd;
for (Vertex vertex : graph.getVertices()) {
System.out.println(vertex.getId());
}
for (Edge edge : graph.getEdges()) {
System.out.println(edge.getId());
}
// node2.addEdgeTo(node11); // node2.addEdgeTo(node11);
......
...@@ -78,6 +78,8 @@ public class GraphImpl implements Graph { ...@@ -78,6 +78,8 @@ public class GraphImpl implements Graph {
} }
} }
// TODO Maybe: Check whether both vertices are in the same graph
final Edge edge = new EdgeImpl(idString, outVertex, inVertex, this); final Edge edge = new EdgeImpl(idString, outVertex, inVertex, this);
this.edges.put(edge.getId().toString(), edge); this.edges.put(edge.getId().toString(), edge);
((VertexImpl) outVertex).addOutEdge(edge); ((VertexImpl) outVertex).addOutEdge(edge);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment