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

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

本文整理了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

  1. private double getEdgeWeight(Edge edge, boolean isDynamicWeight, Interval interval) {
  2. if (isDynamicWeight) {
  3. return edge.getWeight(interval);
  4. } else {
  5. return edge.getWeight();
  6. }
  7. }

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

  1. private double getEdgeWeight(Edge edge, boolean isDynamicWeight, Interval interval) {
  2. if (isDynamicWeight) {
  3. return edge.getWeight(interval);
  4. } else {
  5. return edge.getWeight();
  6. }
  7. }

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

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

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

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

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

  1. @Override
  2. public Number[] getValues(Graph graph) {
  3. List<Number> values = new ArrayList<>();
  4. for (Edge e : graph.getEdges()) {
  5. double weight = e.getWeight(graph.getView());
  6. values.add(weight);
  7. }
  8. return values.toArray(new Number[0]);
  9. }

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

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

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

  1. private double finalQ(int[] struct, double[] degrees, Graph graph,
  2. CommunityStructure theStructure, double totalWeight, double usedResolution, boolean weighted) {
  3. double res = 0;
  4. double[] internal = new double[degrees.length];
  5. for (Node n : graph.getNodes()) {
  6. int n_index = theStructure.map.get(n);
  7. for (Edge edge : graph.getEdges(n)) {
  8. Node neighbor = graph.getOpposite(n, edge);
  9. if (n == neighbor) {
  10. continue;
  11. }
  12. int neigh_index = theStructure.map.get(neighbor);
  13. if (struct[neigh_index] == struct[n_index]) {
  14. if (weighted) {
  15. internal[struct[neigh_index]] += edge.getWeight(graph.getView());
  16. } else {
  17. internal[struct[neigh_index]]++;
  18. }
  19. }
  20. }
  21. }
  22. for (int i = 0; i < degrees.length; i++) {
  23. internal[i] /= 2.0;
  24. res += usedResolution * (internal[i] / totalWeight) - Math.pow(degrees[i] / (2 * totalWeight), 2);//HERE
  25. }
  26. return res;
  27. }

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

  1. @Override
  2. protected void refresh() {
  3. if (graph.getEdgeCount() > 0) {
  4. double minV = Double.MAX_VALUE;
  5. double maxV = Double.MIN_VALUE;
  6. for (Edge e : graph.getEdges()) {
  7. if (e.hasDynamicWeight()) {
  8. TimeMap timeMap = (TimeMap) e.getAttribute("weight");
  9. if (timeMap != null) {
  10. Double numMin = (Double) timeMap.get(graph.getView().getTimeInterval(), Estimator.MIN);
  11. Double numMax = (Double) timeMap.get(graph.getView().getTimeInterval(), Estimator.MAX);
  12. minV = Math.min(numMin, minV);
  13. maxV = Math.max(numMax, maxV);
  14. }
  15. } else {
  16. minV = Math.min(e.getWeight(), minV);
  17. maxV = Math.max(e.getWeight(), maxV);
  18. }
  19. }
  20. min = minV;
  21. max = maxV;
  22. }
  23. }
  24. }

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

  1. private void setInitialValues(Graph graph, Map<Node, Integer> indicies, double[] pagerankValues, double[] weights, boolean directed, boolean useWeights) {
  2. final int N = graph.getNodeCount();
  3. for (Node s : graph.getNodes()) {
  4. final int index = indicies.get(s);
  5. pagerankValues[index] = 1.0 / N;
  6. if (useWeights) {
  7. double sum = 0;
  8. EdgeIterable eIter;
  9. if (directed) {
  10. eIter = ((DirectedGraph) graph).getOutEdges(s);
  11. } else {
  12. eIter = ((UndirectedGraph) graph).getEdges(s);
  13. }
  14. for (Edge edge : eIter) {
  15. if(!edge.isSelfLoop()){
  16. sum += edge.getWeight();
  17. }
  18. }
  19. weights[index] = sum;
  20. }
  21. }
  22. }

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public Item[] getItems(Graph graph) {
  3. EdgeItem[] items = new EdgeItem[graph.getEdgeCount()];
  4. int i = 0;
  5. for (Edge e : graph.getEdges()) {
  6. EdgeItem item = new EdgeItem(e);
  7. item.setData(EdgeItem.WEIGHT, e.getWeight(graph.getView()));
  8. item.setData(EdgeItem.DIRECTED, e.isDirected());
  9. if (graph.isDirected(e)) {
  10. item.setData(EdgeItem.MUTUAL, ((DirectedGraph) graph).getMutualEdge(e) != null);
  11. }
  12. item.setData(EdgeItem.SELF_LOOP, e.isSelfLoop());
  13. item.setData(EdgeItem.COLOR, e.alpha() == 0 ? null : e.getColor());
  14. items[i++] = item;
  15. }
  16. return items;
  17. }

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

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

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

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

相关文章