org.gephi.graph.api.Graph.getNodes()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.gephi.graph.api.Graph.getNodes()方法的一些代码示例,展示了Graph.getNodes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getNodes()方法的具体详情如下:
包路径:org.gephi.graph.api.Graph
类名称:Graph
方法名:getNodes

Graph.getNodes介绍

[英]Gets all the nodes in the graph.
[中]获取图形中的所有节点。

代码示例

代码示例来源:origin: org.gephi/appearance-api

@Override
public Iterable<Node> getElements() {
  return graph.getNodes();
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
}

代码示例来源:origin: org.gephi/statistics-plugin

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++;
  }
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
}

代码示例来源:origin: org.gephi/statistics-plugin

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]);
  }
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
    }
  }
}

代码示例来源:origin: org.gephi/layout-plugin

@Override
public void endAlgo() {
  for (Node n : graph.getNodes()) {
    n.setLayoutData(null);
  }
}

代码示例来源:origin: org.gephi/filters-plugin

@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]);
}

代码示例来源:origin: org.gephi/statistics-plugin

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;
}

代码示例来源:origin: org.gephi/datalab-api

/**
 * 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();
}

代码示例来源:origin: org.gephi/layout-plugin

@Override
public void endAlgo() {
  graph.readLock();
  try {
    for (Node n : graph.getNodes()) {
      n.setLayoutData(null);
    }
    pool.shutdown();
  } finally {
    graph.readUnlockAll();
  }
}

代码示例来源:origin: org.gephi/layout-plugin

@Override
public void endAlgo() {
  graph.readLock();
  try {
    for (Node n : graph.getNodes()) {
      n.setLayoutData(null);
    }
  } finally {
    graph.readUnlockAll();
  }
}

代码示例来源:origin: org.gephi/layout-plugin

@Override
public void endAlgo() {
  graph.readLock();
  try {
    for (Node n : graph.getNodes()) {
      n.setLayoutData(null);
    }
  } finally {
    graph.readUnlockAll();
  }
}

代码示例来源:origin: org.gephi/layout-plugin

@Override
public void endAlgo() {
  graph.readLock();
  try {
    for (Node n : graph.getNodes()) {
      n.setLayoutData(null);
    }
  } finally {
    graph.readUnlockAll();
  }
}

代码示例来源:origin: org.gephi/statistics-plugin

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]);
  }
}

代码示例来源:origin: org.gephi/layout-plugin

@Override
public void endAlgo() {
  graph.readLock();
  try {
    for (Node n : graph.getNodes()) {
      n.setLayoutData(null);
    }
  } finally {
    graph.readUnlockAll();
  }
}

代码示例来源:origin: org.gephi/statistics-plugin

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]);
  }
}

相关文章