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

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

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

Graph.getEdgeCount介绍

[英]Gets the number of edges in the graph.
[中]获取图形中的边数。

代码示例

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

@Override
public int getElementCount() {
  return graph.getEdgeCount();
}

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

@Override
public boolean init(Graph graph) {
  return graph.getEdgeCount() != 0;
}

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

@Override
public int size() {
  int size = model.getEdgeTypeCount();
  return graph.getEdgeCount(0) == 0 ? size - 1 : size;
}

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

@Override
public float percentage(Object value) {
  int count = count(value);
  return (float) count / graph.getEdgeCount();
}

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

@Override
public int getEdgesCount() {
  Graph graph = getCurrentGraph();
  return graph.getEdgeCount();
}

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

@Override
public Collection getValues() {
  Object[] labels = model.getEdgeTypeLabels();
  ArrayList<Object> col = new ArrayList<>(labels.length);
  for (Object l : labels) {
    if (!(l == null && graph.getEdgeCount(0) == 0)) {
      col.add(l);
    }
  }
  return col;
}

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

public double calculateDensity(Graph graph, boolean isGraphDirected) {
  double result;
  double edgesCount = graph.getEdgeCount();
  double nodesCount = graph.getNodeCount();
  double multiplier = 1;
  if (!isGraphDirected) {
    multiplier = 2;
  }
  result = (multiplier * edgesCount) / (nodesCount * nodesCount - nodesCount);
  return result;
}

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

@Override
public int count(Object value) {
  return graph.getEdgeCount(model.getEdgeType(value));
}

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

public Collection getEdgeTypeLabels() {
  Graph graph = graphModel.getGraph();
  Object[] labels = graphModel.getEdgeTypeLabels();
  ArrayList<Object> col = new ArrayList<>(labels.length);
  for (Object l : labels) {
    if (graph.getEdgeCount(graphModel.getEdgeType(l)) > 0) {
      col.add(l);
    }
  }
  return col;
}

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

@Override
public boolean init(Graph graph) {
  if (AttributeUtils.isNodeColumn(column)) {
    if (graph.getNodeCount() == 0) {
      return false;
    }
  } else if (AttributeUtils.isEdgeColumn(column)) {
    if (graph.getEdgeCount() == 0) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: gephi/gephi-plugins-bootcamp

@Override
public void execute(GraphModel graphModel) {
  Graph graph = graphModel.getGraphVisible();
  selfLoopCount = 0;
  totalEdgeCount = graph.getEdgeCount();
  for (Edge e : graph.getEdges()) {
    if (e.isSelfLoop()) {
      selfLoopCount++;
    }
  }
}

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

@Override
public boolean init(Graph graph) {
  if (AttributeUtils.isNodeColumn(column)) {
    if (graph.getNodeCount() == 0) {
      return false;
    }
  } else if (AttributeUtils.isEdgeColumn(column)) {
    if (graph.getEdgeCount() == 0) {
      return false;
    }
  }
  return true;
}

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

@Override
public boolean init(Graph graph) {
  if (AttributeUtils.isNodeColumn(column)) {
    if (graph.getNodeCount() == 0) {
      return false;
    }
  } else if (AttributeUtils.isEdgeColumn(column)) {
    if (graph.getEdgeCount() == 0) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.gephi/desktop-context

@Override
  public void run() {
    Graph visibleGraph = model.getGraphVisible();
    Graph fullGraph = model.getGraph();
    final int nodesFull = fullGraph.getNodeCount();
    final int nodesVisible = visibleGraph.getNodeCount();
    final int edgesFull = fullGraph.getEdgeCount();
    final int edgesVisible = visibleGraph.getEdgeCount();
    final GraphType graphType = model.isDirected() ? GraphType.DIRECTED : model.isUndirected() ? GraphType.UNDIRECTED : GraphType.MIXED;
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        String visible = NbBundle.getMessage(ContextPanel.class, "ContextPanel.visible");
        String nodeText = String.valueOf(nodesVisible);
        String edgeText = String.valueOf(edgesVisible);
        if (nodesFull != nodesVisible || edgesFull != edgesVisible) {
          nodeText += nodesFull > 0 ? " (" + formatter.format(nodesVisible / (double) nodesFull) + " " + visible + ")" : "";
          edgeText += edgesFull > 0 ? " (" + formatter.format(edgesVisible / (double) edgesFull) + " " + visible + ")" : "";
        }
        nodeLabel.setText(nodeText);
        edgeLabel.setText(edgeText);
        graphTypeLabel.setText(graphType.type);
      }
    });
  }
}

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

@Override
public void loop(GraphView window, Interval interval) {
  Graph graph = graphModel.getGraph(window);
  int count = graph.getEdgeCount();
  
  graphModel.getGraphVisible().setAttribute(NB_EDGES, count, interval.getLow());
  graphModel.getGraphVisible().setAttribute(NB_EDGES, count, interval.getHigh());
  counts.put(interval.getLow(), count);
  counts.put(interval.getHigh(), count);
}

代码示例来源:origin: gephi/gephi-plugins-bootcamp

int tasks = graph.getNodeCount() + graph.getEdgeCount();
Progress.start(progress, tasks);

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

@Override
  protected void refresh() {
    if (graph.getEdgeCount() > 0) {
      double minV = Double.MAX_VALUE;
      double maxV = Double.MIN_VALUE;
      for (Edge e : graph.getEdges()) {
        if (e.hasDynamicWeight()) {
          TimeMap timeMap = (TimeMap) e.getAttribute("weight");
          if (timeMap != null) {
            Double numMin = (Double) timeMap.get(graph.getView().getTimeInterval(), Estimator.MIN);
            Double numMax = (Double) timeMap.get(graph.getView().getTimeInterval(), Estimator.MAX);
            minV = Math.min(numMin, minV);
            maxV = Math.max(numMax, maxV);
          }
        } else {
          minV = Math.min(e.getWeight(), minV);
          maxV = Math.max(e.getWeight(), maxV);
        }
      }
      min = minV;
      max = maxV;
    }
  }
}

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

@Override
public Item[] getItems(Graph graph) {
  EdgeItem[] items = new EdgeItem[graph.getEdgeCount()];
  int i = 0;
  for (Edge e : graph.getEdges()) {
    EdgeItem item = new EdgeItem(e);
    item.setData(EdgeItem.WEIGHT, e.getWeight(graph.getView()));
    item.setData(EdgeItem.DIRECTED, e.isDirected());
    if (graph.isDirected(e)) {
      item.setData(EdgeItem.MUTUAL, ((DirectedGraph) graph).getMutualEdge(e) != null);
    }
    item.setData(EdgeItem.SELF_LOOP, e.isSelfLoop());
    item.setData(EdgeItem.COLOR, e.alpha() == 0 ? null : e.getColor());
    items[i++] = item;
  }
  return items;
}

相关文章