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

x33g5p2x  于2022-01-19 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(162)

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

Edge.getWeight介绍

[英]Returns the edge's weight.
[中]返回边的权重。

代码示例

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

private double getEdgeWeight(Edge edge, boolean isDynamicWeight, Interval interval) {
  if (isDynamicWeight) {
    return edge.getWeight(interval);
  } else {
    return edge.getWeight();
  }
}

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

private double getEdgeWeight(Edge edge, boolean isDynamicWeight, Interval interval) {
  if (isDynamicWeight) {
    return edge.getWeight(interval);
  } else {
    return edge.getWeight();
  }
}

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

protected double edgeWeight(Edge edge) {
  return edge.getWeight();
}

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

@Override
public Number getValue(Element element, Graph gr) {
  return ((Edge) element).getWeight(gr.getView());
}

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

@Override
public Number[] getValues(Graph graph) {
  List<Number> values = new ArrayList<>();
  for (Edge e : graph.getEdges()) {
    double weight = e.getWeight(graph.getView());
    values.add(weight);
  }
  return values.toArray(new Number[0]);
}

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

@Override
public boolean evaluate(Graph graph, Edge edge) {
  double weight = edge.getWeight(graph.getView());
  return range.isInRange(weight);
}

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

private double finalQ(int[] struct, double[] degrees, Graph graph,
    CommunityStructure theStructure, double totalWeight, double usedResolution, boolean weighted) {
  double res = 0;
  double[] internal = new double[degrees.length];
  for (Node n : graph.getNodes()) {
    int n_index = theStructure.map.get(n);
    for (Edge edge : graph.getEdges(n)) {
      Node neighbor = graph.getOpposite(n, edge);
      if (n == neighbor) {
        continue;
      }
      int neigh_index = theStructure.map.get(neighbor);
      if (struct[neigh_index] == struct[n_index]) {
        if (weighted) {
          internal[struct[neigh_index]] += edge.getWeight(graph.getView());
        } else {
          internal[struct[neigh_index]]++;
        }
      }
    }
  }
  for (int i = 0; i < degrees.length; i++) {
    internal[i] /= 2.0;
    res += usedResolution * (internal[i] / totalWeight) - Math.pow(degrees[i] / (2 * totalWeight), 2);//HERE
  }
  return res;
}

代码示例来源: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/statistics-plugin

private void setInitialValues(Graph graph, Map<Node, Integer> indicies, double[] pagerankValues, double[] weights, boolean directed, boolean useWeights) {
  final int N = graph.getNodeCount();
  for (Node s : graph.getNodes()) {
    final int index = indicies.get(s);
    pagerankValues[index] = 1.0 / N;
    if (useWeights) {
      double sum = 0;
      EdgeIterable eIter;
      if (directed) {
        eIter = ((DirectedGraph) graph).getOutEdges(s);
      } else {
        eIter = ((UndirectedGraph) graph).getEdges(s);
      }
      for (Edge edge : eIter) {
        if(!edge.isSelfLoop()){
          sum += edge.getWeight();
        }
      }
      weights[index] = sum;
    }
  }
}

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

for (Edge edge : graph.getEdges(node, neighbor, edgeType)) {
  if (useWeight) {
    weight += edge.getWeight(graph.getView());
  } else {
    weight += 1;

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

String sourceId = e.getSource().getId().toString();
String targetId = e.getTarget().getId().toString();
String weight = String.valueOf(e.getWeight());
statement.executeUpdate("insert into edges values('" + sourceId + "', '" + targetId + "', '" + weight + "')");
if (cancel) {

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

for (Edge e : directedGraph.getEdges(n)) {
    if (e.getSource().equals(n)) {
      totalOutWeight += e.getWeight();
      totalInWeight += e.getWeight();
} else {
  for (Edge e : graph.getEdges(n)) {
    totalWeight += (e.isSelfLoop() ? 2 : 1) * e.getWeight();

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

if (!edge.isSelfLoop()) {
  Node neighbor = graph.getOpposite(node, edge);
  inWeightPerNeighbor.addTo(neighbor, edge.getWeight());

代码示例来源: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;
}

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

int target = idMap.get(e.getTarget().getStoreId());
if (source != target) {        //No self-loop
  float weight = (float) (isDynamicWeight ? e.getWeight(interval) : e.getWeight());
  if (neighbors[source] == null) {
    neighbors[source] = new TIntFloatHashMap();

代码示例来源:origin: org.gephi/visualization

model = edges[id];
float w = (float) edge.getWeight(graphView);
model.setWeight(w);
minWeight = Math.min(w, minWeight);

相关文章