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

work on nested graph library

parent 67ad2f80
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
......@@ -27,6 +27,44 @@ public class GraphTester {
assert node1 == node1snd;
System.out.println("Master graph");
for (Vertex vertex : graph.getVertices()) {
System.out.println(vertex.getId());
}
for (Edge edge : graph.getEdges()) {
System.out.println(edge.getId());
}
// BlueprintsExporter blueprintsExporter = new BlueprintsExporter(graph);
// System.out.println(blueprintsExporter.exportGraph());
node1snd.remove();
for (Vertex vertex : graph.getVertices()) {
System.out.println(vertex.getId());
}
node1.addChildGraph();
Vertex node1sub1 = node1.getChildGraph().addVertex("n1::s1");
Vertex node1sub2 = node1.getChildGraph().addVertex("n1::s2");
Vertex node1sub3 = node1.getChildGraph().addVertex("n1::s3");
node1sub3.addEdge("wormhole", node4);
System.out.println("Node 1's child graph");
for (Vertex vertex : node1.getChildGraph().getVertices()) {
System.out.println(vertex.getId());
}
for (Edge edge : node1.getChildGraph().getEdges()) {
System.out.println(edge.getId());
}
System.out.println("Master graph");
for (Vertex vertex : graph.getVertices()) {
System.out.println(vertex.getId());
}
......@@ -37,6 +75,10 @@ public class GraphTester {
// node2.addEdgeTo(node11);
// Export to Blueprints
// BlueprintsExporter blueprintsExporter = new BlueprintsExporter(graph);
// System.out.println(blueprintsExporter.exportGraph());
}
}
package kieker.analysis.graph;
public interface Subgraph {
}
......@@ -2,10 +2,12 @@ package kieker.analysis.graph;
public interface Vertex extends Element {
public Graph getChildGraph();
public Graph addChildGraph();
public boolean hasChildGraph();
public Graph getChildGraph();
public Iterable<Edge> getEdges(Direction direction);
public Iterable<Vertex> getVertices(Direction direction);
......
......@@ -11,7 +11,7 @@ abstract class ElementImpl implements Element {
protected Map<String, Object> properties = new HashMap<String, Object>();
protected final String id;
protected final GraphImpl graph; // TODO Maybe Graph as type?
protected final GraphImpl graph;
protected ElementImpl(final String id, final GraphImpl graph) {
this.graph = graph;
......
......@@ -57,7 +57,10 @@ public class GraphImpl implements Graph {
throw ExceptionFactory.vertexWithIdDoesNotExist(vertex.getId());
}
for (Edge edge : vertex.getEdges(Direction.BOTH)) {
for (Edge edge : vertex.getEdges(Direction.IN)) {
this.removeEdge(edge);
}
for (Edge edge : vertex.getEdges(Direction.OUT)) {
this.removeEdge(edge);
}
......
......@@ -13,6 +13,7 @@ class VertexImpl extends ElementImpl implements Vertex {
protected Map<String, Edge> outEdges = new HashMap<String, Edge>();
protected Map<String, Edge> inEdges = new HashMap<String, Edge>();
private Graph childGraph;
protected VertexImpl(final String id, final GraphImpl graph) {
super(id, graph);
......@@ -20,14 +21,18 @@ class VertexImpl extends ElementImpl implements Vertex {
@Override
public Graph addChildGraph() {
// TODO Auto-generated method stub
return null;
this.childGraph = new GraphImpl();
return getChildGraph();
}
@Override
public boolean hasChildGraph() {
return (this.childGraph == null);
}
@Override
public Graph getChildGraph() {
// TODO Auto-generated method stub
return null;
return childGraph;
}
@Override
......
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