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

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

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

Graph.removeEdge介绍

[英]Removes an edge from this graph.
[中]从此图形中删除边。

代码示例

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

private void removeEdge(Edge edge, Graph graph) {
    graph.removeEdge(edge);
  }
}

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

graph.removeEdge(e);

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

graph.removeEdge(e);

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

@Override
  public void actionPerformed(ActionEvent e) {
    //Get the current graph model
    GraphController gc = Lookup.getDefault().lookup(GraphController.class);
    GraphModel graphModel = gc.getGraphModel();

    if (graphModel != null) {
      //Remove self loops
      int removed = 0;
      Graph graph = graphModel.getGraph();
      graph.writeLock();
      for (Edge edge : graph.getEdges().toArray()) {
        if (edge.isSelfLoop()) {
          graph.removeEdge(edge);
          removed++;
        }
      }
      graph.writeUnlock();

      //Notification message
      NotifyDescriptor d = new NotifyDescriptor.Message(removed + " self-loop have been removed", NotifyDescriptor.INFORMATION_MESSAGE);
      DialogDisplayer.getDefault().notify(d);
    } else {
      //Error message
      NotifyDescriptor d = new NotifyDescriptor.Message("No active workspace", NotifyDescriptor.ERROR_MESSAGE);
      DialogDisplayer.getDefault().notify(d);
    }

  }
}

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

@Override
public Graph filter(Subgraph[] graphs) {
  if (graphs.length > 1) {
    throw new IllegalArgumentException("Not Filter accepts a single graph in parameter");
  }
  Graph graph = graphs[0];
  Graph mainGraph = graph.getView().getGraphModel().getGraph();
  for (Edge e : mainGraph.getEdges()) {
    Node source = e.getSource();
    Node target = e.getTarget();
    if (graph.contains(source) && graph.contains(target)) {
      Edge edgeInGraph = graph.getEdge(source, target, e.getType());
      if (edgeInGraph == null) {
        //The edge is not in graph
        graph.addEdge(e);
      } else {
        //The edge is in the graph
        graph.removeEdge(edgeInGraph);
      }
    }
  }
  return graph;
}

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

graph.removeEdge(e);
} else {
  graph.removeEdge(f);

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

graph.removeEdge(e);

相关文章