@Override public Graph<V, E> create() { return new SparseGraph<V, E>(); } };
public Graph<V,E> get() { return new SparseGraph<V,E>(); } };
@Override public SparseGraph<V, E> newInstance() { return new SparseGraph<V, E>(); }
/** * Returns a {@code Factory} that creates an instance of this graph type. * * @param <V> * the vertex type for the graph factory * @param <E> * the edge type for the graph factory */ public static <V, E> Factory<Graph<V, E>> getFactory() { return new Factory<Graph<V, E>>() { @Override public Graph<V, E> create() { return new SparseGraph<V, E>(); } }; }
private Graph<String,Number> generateVertexGrid(Map<String,Point2D> vlf, Dimension d, int interval) { int count = d.width/interval * d.height/interval; Graph<String,Number> graph = new SparseGraph<String,Number>(); for(int i=0; i<count; i++) { int x = interval*i; int y = x / d.width * interval; x %= d.width; Point2D location = new Point2D.Float(x, y); String vertex = "v"+i; vlf.put(vertex, location); graph.addVertex(vertex); } return graph; }
@Override public void updateLayout(Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>(); Collection<? extends Vertex> vertices = graph.getDisplayVertices(); for(Vertex v : vertices) { jungGraph.addVertex(v); } Collection<? extends Edge> edges = graph.getDisplayEdges(); for(Edge e : edges) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } Dimension size = selectLayoutSize(graph); Dimension paddedSize = new Dimension((int)(size.getWidth()*.75), (int)(size.getHeight()*.75)); doISOMLayout(graphLayout, jungGraph, size); doSpringLayout(graphLayout, jungGraph, size, SPRING_LAYOUT_REPULSION); doFRLayout(graphLayout, jungGraph, paddedSize, (int)(size.getWidth()/8.0), (int)(size.getHeight()/8.0)); doSpringLayout(graphLayout, jungGraph, size, SPRING_LAYOUT_REPULSION); }
@Override public void updateLayout(Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>(); Collection<? extends Vertex> vertices = graph.getDisplayVertices(); for(Vertex v : vertices) { jungGraph.addVertex(v); } Collection<? extends Edge> edges = graph.getDisplayEdges(); for(Edge e : edges) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } Dimension size = selectLayoutSize(graph); Dimension paddedSize = new Dimension((int)(size.getWidth()*.75), (int)(size.getHeight()*.75)); doISOMLayout(graphLayout, jungGraph, size); doSpringLayout(graphLayout, jungGraph, size, SPRING_LAYOUT_REPULSION); doFRLayout(graphLayout, jungGraph, paddedSize, (int)(size.getWidth()/8.0), (int)(size.getHeight()/8.0)); doSpringLayout(graphLayout, jungGraph, size, SPRING_LAYOUT_REPULSION); }
@Override public void updateLayout(final Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>(); Collection<Vertex> vertices = graph.getDisplayVertices(); for(Vertex v : vertices) { jungGraph.addVertex(v); } Collection<Edge> edges = graph.getDisplayEdges(); for(Edge e : edges) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } TopoFRLayout<VertexRef, EdgeRef> layout = new TopoFRLayout<VertexRef, EdgeRef>(jungGraph); // Initialize the vertex positions to the last known positions from the layout Dimension size = selectLayoutSize(graph); layout.setInitializer(initializer(graphLayout, (int)size.getWidth()/2, (int)size.getHeight()/2)); // Resize the graph to accommodate the number of vertices layout.setSize(size); while(!layout.done()) { layout.step(); } // Store the new positions in the layout for(Vertex v : vertices) { graphLayout.setLocation(v, new Point(layout.getX(v) - (size.getWidth()/2), (int)layout.getY(v) - (size.getHeight()/2))); } }
@Override public void updateLayout(final Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>(); Collection<Vertex> vertices = graph.getDisplayVertices(); for(Vertex v : vertices) { jungGraph.addVertex(v); } Collection<Edge> edges = graph.getDisplayEdges(); for(Edge e : edges) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } FRLayout<VertexRef, EdgeRef> layout = new FRLayout<VertexRef, EdgeRef>(jungGraph); // Initialize the vertex positions to the last known positions from the layout Dimension size = selectLayoutSize(graph); layout.setInitializer(initializer(graphLayout, (int)size.getWidth()/2, (int)size.getHeight()/2)); // Resize the graph to accommodate the number of vertices layout.setSize(size); while(!layout.done()) { layout.step(); } // Store the new positions in the layout for(Vertex v : vertices) { graphLayout.setLocation(v, new Point(layout.getX(v) - (size.getWidth()/2), (int)layout.getY(v) - (size.getHeight()/2))); } }
@Override public void updateLayout(final Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>(); Collection<Vertex> vertices = graph.getDisplayVertices(); for(Vertex v : vertices) { jungGraph.addVertex(v); } Collection<Edge> edges = graph.getDisplayEdges(); for(Edge e : edges) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } FRLayout<VertexRef, EdgeRef> layout = new FRLayout<VertexRef, EdgeRef>(jungGraph); // Initialize the vertex positions to the last known positions from the layout Dimension size = selectLayoutSize(graph); layout.setInitializer(initializer(graphLayout, (int)size.getWidth()/2, (int)size.getHeight()/2)); // Resize the graph to accommodate the number of vertices layout.setSize(size); while(!layout.done()) { layout.step(); } // Store the new positions in the layout for(Vertex v : vertices) { graphLayout.setLocation(v, new Point(layout.getX(v) - (size.getWidth()/2), (int)layout.getY(v) - (size.getHeight()/2))); } }
@Override public void updateLayout(final Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>(); Collection<Vertex> vertices = graph.getDisplayVertices(); for(Vertex v : vertices) { jungGraph.addVertex(v); } Collection<Edge> edges = graph.getDisplayEdges(); for(Edge e : edges) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } TopoFRLayout<VertexRef, EdgeRef> layout = new TopoFRLayout<VertexRef, EdgeRef>(jungGraph); // Initialize the vertex positions to the last known positions from the layout Dimension size = selectLayoutSize(graph); layout.setInitializer(initializer(graphLayout, (int)size.getWidth()/2, (int)size.getHeight()/2)); // Resize the graph to accommodate the number of vertices layout.setSize(size); while(!layout.done()) { layout.step(); } // Store the new positions in the layout for(Vertex v : vertices) { graphLayout.setLocation(v, new Point(layout.getX(v) - (size.getWidth()/2), (int)layout.getY(v) - (size.getHeight()/2))); } }
final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();
final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();
@Override public void updateLayout(final Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, Edge> jungGraph = new SparseGraph<VertexRef, Edge>(); Collection<? extends Vertex> vertices = graph.getDisplayVertices(); for(VertexRef v : vertices) { jungGraph.addVertex(v); } for(Edge e : graph.getDisplayEdges()) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } CircleLayout<VertexRef, Edge> layout = new CircleLayout<VertexRef, Edge>(jungGraph); layout.setInitializer(initializer(graphLayout)); layout.setSize(selectLayoutSize(graph)); for(VertexRef v : vertices) { graphLayout.setLocation(v, new Point(layout.getX(v), layout.getY(v))); } }
@Override public void updateLayout(final Graph graph) { final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, Edge> jungGraph = new SparseGraph<VertexRef, Edge>(); Collection<? extends Vertex> vertices = graph.getDisplayVertices(); for(VertexRef v : vertices) { jungGraph.addVertex(v); } for(Edge e : graph.getDisplayEdges()) { jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex()); } CircleLayout<VertexRef, Edge> layout = new CircleLayout<VertexRef, Edge>(jungGraph); layout.setInitializer(initializer(graphLayout)); layout.setSize(selectLayoutSize(graph)); for(VertexRef v : vertices) { graphLayout.setLocation(v, new Point(layout.getX(v), layout.getY(v))); } }
SparseGraph<VertexRef, Edge> jungGraph = new SparseGraph<VertexRef, Edge>();
SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();
SparseGraph<VertexRef, Edge> jungGraph = new SparseGraph<VertexRef, Edge>();
SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();
final Layout graphLayout = graph.getLayout(); SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();