@Override public void endAlgo() { graph.readLock(); try { for (Node n : graph.getNodes()) { n.setLayoutData(null); } pool.shutdown(); } finally { graph.readUnlockAll(); } }
@Override public void endAlgo() { graph.readLock(); try { for (Node n : graph.getNodes()) { n.setLayoutData(null); } } finally { graph.readUnlockAll(); } }
@Override public void endAlgo() { graph.readLock(); try { for (Node n : graph.getNodes()) { n.setLayoutData(null); } } finally { graph.readUnlockAll(); } }
@Override public void endAlgo() { graph.readLock(); try { for (Node n : graph.getNodes()) { n.setLayoutData(null); } } finally { graph.readUnlockAll(); } }
@Override public void endAlgo() { graph.readLock(); try { for (Node n : graph.getNodes()) { n.setLayoutData(null); } } finally { graph.readUnlockAll(); } }
@Override public void goAlgo() { graph = graphModel.getGraphVisible(); graph.readLock(); try { for (Node n : graph.getNodes()) { n.setX((float) (-size / 2 + size * random.nextDouble())); n.setY((float) (-size / 2 + size * random.nextDouble())); } converged = true; } finally { graph.readUnlockAll(); } }
@Override public void run() { Graph graph = graphModel.getGraph(); boolean runListener = false; graph.writeLock(); try { runListener = initObserver(); } finally { graph.writeUnlock(); graph.readUnlockAll(); } if (!runListener) { runListener = observer.hasGraphChanged(); } if (runListener) { graph.readLock(); try { listener.run(); } finally { graph.readUnlockAll(); } } }
public void execute(Graph graph) { isDirected = graph.isDirected(); isCanceled = false; initializeDegreeDists(); initializeAttributeColunms(graph.getModel()); graph.readLock(); try { avgWDegree = calculateAverageWeightedDegree(graph, isDirected, true); } finally { graph.readUnlockAll(); } }
public void execute(Graph graph) { isCanceled = false; Column column = initializeAttributeColunms(graph.getModel()); graph.readLock(); try { HashMap<Node, Integer> indicies = createIndiciesMap(graph); pageranks = calculatePagerank(graph, indicies, isDirected, useEdgeWeight, epsilon, probability); saveCalculatedValues(graph, column, indicies, pageranks); } finally { graph.readUnlockAll(); } }
return false; } finally { currentGraphModel.getGraph().readUnlockAll();
@Override public void goAlgo() { graph = graphModel.getGraphVisible(); graph.readLock(); try { double sin = Math.sin(-getAngle() * Math.PI / 180); double cos = Math.cos(-getAngle() * Math.PI / 180); double px = 0f; double py = 0f; for (Node n : graph.getNodes()) { double dx = n.x() - px; double dy = n.y() - py; n.setX((float) (px + dx * cos - dy * sin)); n.setY((float) (py + dy * cos + dx * sin)); } setConverged(true); } finally { graph.readUnlockAll(); } }
public void execute(Graph graph) { initializeAttributeColunms(graph.getModel()); graph.readLock(); try { int N = graph.getNodeCount(); authority = new double[N]; hubs = new double[N]; Map<Node, Integer> indices = createIndicesMap(graph); calculateHits(graph, hubs, authority, indices, !useUndirected, epsilon); saveCalculatedValues(indices, authority, hubs); } finally { graph.readUnlockAll(); } }
public void execute(Graph graph) { isDirected = graph.isDirected(); isCanceled = false; initializeDegreeDists(); initializeAttributeColunms(graph.getModel()); graph.readLock(); try { avgDegree = calculateAverageDegree(graph, isDirected, true); graph.setAttribute(AVERAGE_DEGREE, avgDegree); } finally { graph.readUnlockAll(); } }
protected void refreshFunctions() { graph.readLock(); try { boolean graphHasChanged = graphObserver.isNew() || graphObserver.hasGraphChanged(); if (graphHasChanged) { if (graphObserver.isNew()) { graphObserver.hasGraphChanged(); } refreshGraphFunctions(); } refreshAttributeFunctions(graphHasChanged); } finally { graph.readUnlockAll(); } }
@Override public void initAlgo() { if (graphModel == null) { return; } graph = graphModel.getGraphVisible(); graph.readLock(); try { energy = Float.POSITIVE_INFINITY; for (Node n : graph.getNodes()) { n.setLayoutData(new ForceVector()); } progress = 0; setConverged(false); setStep(initialStep); } finally { graph.readUnlockAll(); } }
@Override public void initAlgo() { AbstractLayout.ensureSafeLayoutNodePositions(graphModel); speed = 1.; speedEfficiency = 1.; graph = graphModel.getGraphVisible(); graph.readLock(); try { Node[] nodes = graph.getNodes().toArray(); // Initialise layout data for (Node n : nodes) { if (n.getLayoutData() == null || !(n.getLayoutData() instanceof ForceAtlas2LayoutData)) { ForceAtlas2LayoutData nLayout = new ForceAtlas2LayoutData(); n.setLayoutData(nLayout); } ForceAtlas2LayoutData nLayout = n.getLayoutData(); nLayout.mass = 1 + graph.getDegree(n); nLayout.old_dx = 0; nLayout.old_dy = 0; nLayout.dx = 0; nLayout.dy = 0; } pool = Executors.newFixedThreadPool(threadCount); currentThreadCount = threadCount; } finally { graph.readUnlockAll(); } }
private double bruteForce(Graph graph) { //The atrributes computed by the statistics Column clusteringColumn = initializeAttributeColunms(graph.getModel()); float totalCC = 0; graph.readLock(); try { Progress.start(progress, graph.getNodeCount()); int node_count = 0; NodeIterable nodesIterable = graph.getNodes(); for (Node node : nodesIterable) { float nodeClusteringCoefficient = computeNodeClusteringCoefficient(graph, node, isDirected); if (nodeClusteringCoefficient > -1) { saveCalculatedValue(node, clusteringColumn, nodeClusteringCoefficient); totalCC += nodeClusteringCoefficient; } if (isCanceled) { nodesIterable.doBreak(); break; } node_count++; Progress.progress(progress, node_count); } double clusteringCoeff = totalCC / graph.getNodeCount(); return clusteringCoeff; } finally { graph.readUnlockAll(); } }
@Override public void goAlgo() { graph = graphModel.getGraphVisible(); graph.readLock(); try { double xMean = 0, yMean = 0; for (Node n : graph.getNodes()) { xMean += n.x(); yMean += n.y(); } xMean /= graph.getNodeCount(); yMean /= graph.getNodeCount(); for (Node n : graph.getNodes()) { double dx = (n.x() - xMean) * getScale(); double dy = (n.y() - yMean) * getScale(); n.setX((float) (xMean + dx)); n.setY((float) (yMean + dy)); } setConverged(true); } finally { graph.readUnlockAll(); } }