@Override public Iterable<Node> getElements() { return graph.getNodes(); }
public HashMap<Node, Integer> createIndicesMap(Graph graph) { HashMap<Node, Integer> newIndices = new HashMap<>(); int index = 0; for (Node s : graph.getNodes()) { newIndices.put(s, index); index++; } return newIndices; }
public HashMap<Node, Integer> createIndiciesMap(Graph graph) { HashMap<Node, Integer> newIndicies = new HashMap<>(); int index = 0; for (Node s : graph.getNodes()) { newIndicies.put(s, index); index++; } return newIndicies; }
public HashMap<Node, Integer> createIndicesMap(Graph graph) { HashMap<Node, Integer> indices = new HashMap<>(); int index = 0; for (Node s : graph.getNodes()) { indices.put(s, index); index++; } return indices; }
public HashMap<Node, Integer> createIndiciesMap(Graph graph) { HashMap<Node, Integer> indicies = new HashMap<>(); int index = 0; for (Node s : graph.getNodes()) { indicies.put(s, index); index++; } return indicies; }
public void fillIndiciesMaps(Graph graph, double[] eigCentralities, HashMap<Integer, Node> indicies, HashMap<Node, Integer> invIndicies) { if (indicies == null || invIndicies == null) { return; } int count = 0; for (Node u : graph.getNodes()) { indicies.put(count, u); invIndicies.put(u, count); eigCentralities[count] = 1; count++; } }
private double[] fillDegreeCount(Graph graph, CommunityStructure theStructure, int[] comStructure, double[] nodeDegrees, boolean weighted) { double[] degreeCount = new double[theStructure.communities.size()]; for (Node node : graph.getNodes()) { int index = theStructure.map.get(node); if (weighted) { degreeCount[comStructure[index]] += nodeDegrees[index]; } else { degreeCount[comStructure[index]] += graph.getDegree(node); } } return degreeCount; }
private void saveCalculatedValues(Graph graph, Column attributeColumn, HashMap<Node, Integer> indicies, double[] nodePagrank) { for (Node s : graph.getNodes()) { int s_index = indicies.get(s); s.setAttribute(attributeColumn, nodePagrank[s_index]); } }
private void calculateCorrection(Graph graph, HashMap<Node, Integer> indicies, double[] nodeBetweenness, boolean directed, boolean normalized) { int n = graph.getNodeCount(); for (Node s : graph.getNodes()) { int s_index = indicies.get(s); if (!directed) { nodeBetweenness[s_index] /= 2; } if (normalized) { nodeBetweenness[s_index] /= directed ? (n - 1) * (n - 2) : (n - 1) * (n - 2) / 2; } } }
@Override public void endAlgo() { for (Node n : graph.getNodes()) { n.setLayoutData(null); } }
@Override public Number[] getValues(Graph graph) { List<Integer> values = new ArrayList<>(graph.getNodeCount()); for (Node n : graph.getNodes()) { int degree = graph.getDegree(n); values.add(degree); } return values.toArray(new Number[0]); }
public int createIndiciesMapAndInitNetwork(Graph graph, HashMap<Node, Integer> indicies, ArrayWrapper[] networks, int currentProgress) { int index = 0; for (Node s : graph.getNodes()) { indicies.put(s, index); networks[index] = new ArrayWrapper(); index++; Progress.progress(progress, ++currentProgress); } return currentProgress; }
/** * Used for iterating through all nodes of the graph * * @return Array with all graph nodes */ private Node[] getNodesArray() { return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph().getNodes().toArray(); }
@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(); } }
private void saveCalculatedValues(Graph graph, HashMap<Node, Integer> indicies, double[] nodeEccentricity, double[] nodeBetweenness, double[] nodeCloseness, double[] nodeHarmonicCloseness) { for (Node s : graph.getNodes()) { int s_index = indicies.get(s); s.setAttribute(ECCENTRICITY, nodeEccentricity[s_index]); s.setAttribute(CLOSENESS, nodeCloseness[s_index]); s.setAttribute(HARMONIC_CLOSENESS, nodeHarmonicCloseness[s_index]); s.setAttribute(BETWEENNESS, nodeBetweenness[s_index]); } }
@Override public void endAlgo() { graph.readLock(); try { for (Node n : graph.getNodes()) { n.setLayoutData(null); } } finally { graph.readUnlockAll(); } }
private void saveValues(int[] struct, Graph graph, CommunityStructure theStructure) { Table nodeTable = graph.getModel().getNodeTable(); Column modCol = nodeTable.getColumn(MODULARITY_CLASS); if (modCol == null) { modCol = nodeTable.addColumn(MODULARITY_CLASS, "Modularity Class", Integer.class, 0); } for (Node n : graph.getNodes()) { int n_index = theStructure.map.get(n); n.setAttribute(modCol, struct[n_index]); } }