for(V v1 : getGraph().getVertices()) { calcRepulsion(v1); for(E e : getGraph().getEdges()) { calcAttraction(e); for(V v : getGraph().getVertices()) { if (isLocked(v)) continue; calcPositions(v); cool();
public void reset() { doInit(); }
private void doInit() { Graph<V,E> graph = getGraph(); Dimension d = getSize(); if(graph != null && d != null) { currentIteration = 0; temperature = d.getWidth() / 10; forceConstant = Math .sqrt(d.getHeight() * d.getWidth() / graph.getVertexCount()); attraction_constant = attraction_multiplier * forceConstant; repulsion_constant = repulsion_multiplier * forceConstant; } }
if(fvd1 == null) return; fvd1.setLocation(0, 0); boolean v1_locked = isLocked(v1); for(V v2 : getGraph().getVertices()) { boolean v2_locked = isLocked(v2); if (v1_locked && v2_locked) continue; if (v1 != v2) { Point2D p1 = transform(v1); Point2D p2 = transform(v2); if(p1 == null || p2 == null) continue; double xDelta = p1.getX() - p2.getX(); calcRepulsion(v1);
if(fvd1 == null) return; fvd1.setLocation(0, 0); boolean v1_locked = isLocked(v1); for(V v2 : getGraph().getVertices()) { boolean v2_locked = isLocked(v2); if (v1_locked && v2_locked) continue; if (v1 != v2) { Point2D p1 = apply(v1); Point2D p2 = apply(v2); if(p1 == null || p2 == null) continue; double xDelta = p1.getX() - p2.getX(); calcRepulsion(v1);
private static AbstractLayout<Vertex, Edge> getLayout(GraphJung<Graph> graph, String layoutName) { switch (layoutName) { case "KKLayout": return new KKLayout<>(graph); case "CircleLayout": return new CircleLayout<>(graph); case "FRLayout": return new FRLayout<>(graph); case "FRLayout2": return new FRLayout2<>(graph); case "ISOMLayout": return new ISOMLayout<>(graph); case "SpringLayout": return new SpringLayout<>(graph); default: return new KKLayout<>(graph); } }
protected void calcAttraction(E e) { Pair<V> endpoints = getGraph().getEndpoints(e); V v1 = endpoints.getFirst(); V v2 = endpoints.getSecond(); boolean v1_locked = isLocked(v1); boolean v2_locked = isLocked(v2); Point2D p1 = transform(v1); Point2D p2 = transform(v2); if(p1 == null || p2 == null) return; double xDelta = p1.getX() - p2.getX();
protected void calcAttraction(E e) { Pair<V> endpoints = getGraph().getEndpoints(e); V v1 = endpoints.getFirst(); V v2 = endpoints.getSecond(); boolean v1_locked = isLocked(v1); boolean v2_locked = isLocked(v2); Point2D p1 = apply(v1); Point2D p2 = apply(v2); if(p1 == null || p2 == null) return; double xDelta = p1.getX() - p2.getX();
test = new MyPersistentLayoutImpl(new ISOMLayout<String, String>(graph)); } else if (layout.equals("FRLayout2")) { FRLayout2 frLayout2 = new FRLayout2<String, String>(graph); frLayout2.setRepulsionMultiplier(10);
public FRLayout2(Graph<V, E> g, Dimension d) { super(g, new RandomLocationTransformer<V>(d), d); max_dimension = Math.max(d.height, d.width); initialize(); }
this.g = og; layout = new FRLayout2<Number,Number>(g);
/** * Creates an instance of size {@code d} for the specified graph. */ public FRLayout2(Graph<V, E> g, Dimension d) { super(g, new RandomLocationTransformer<V>(d), d); max_dimension = Math.max(d.height, d.width); initialize(); }
for(V v1 : getGraph().getVertices()) { calcRepulsion(v1); for(E e : getGraph().getEdges()) { calcAttraction(e); for(V v : getGraph().getVertices()) { if (isLocked(v)) continue; calcPositions(v); cool();
break; case FRLayout2: layout = new FRLayout2<N, EdgeWrapper<E>>(graph); break; case SpringLayout2:
private void doInit() { Graph<V,E> graph = getGraph(); Dimension d = getSize(); if(graph != null && d != null) { currentIteration = 0; temperature = d.getWidth() / 10; forceConstant = Math .sqrt(d.getHeight() * d.getWidth() / graph.getVertexCount()); attraction_constant = attraction_multiplier * forceConstant; repulsion_constant = repulsion_multiplier * forceConstant; } }
public void reset() { doInit(); }
break; case FRLayout2: layout = new FRLayout2<N, EdgeWrapper<E>>(graph); break; case SpringLayout2:
public void initialize() { doInit(); }
public void initialize() { doInit(); }