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

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

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

Graph.contains介绍

[英]Returns true if edge is contained in this graph.
[中]如果此图中包含edge,则返回true。

代码示例

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

@Override
public boolean areNodesInGraph(Node[] nodes) {
  Graph graph = getCurrentGraph();
  for (Node n : nodes) {
    if (!graph.contains(n)) {
      return false;
    }
  }
  return true;
}

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

@Override
public boolean areEdgesInGraph(Edge[] edges) {
  Graph graph = getCurrentGraph();
  for (Edge e : edges) {
    if (!graph.contains(e)) {
      return false;
    }
  }
  return true;
}

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

@Override
public boolean isEdgeInGraph(Edge edge) {
  return getCurrentGraph().contains(edge);
}

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

@Override
public boolean isNodeInGraph(Node node) {
  return getCurrentGraph().contains(node);
}

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

if (result.contains(node)) {
  graph.addNode(node);
} else if (graph.contains(node)) {
  graph.removeNode(node);
if (graph.contains(edge.getSource()) && graph.contains(edge.getTarget())) {
  graph.addEdge(edge);

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

boolean source = graph.contains(e.getSource());
boolean target = graph.contains(e.getTarget());
boolean keep = false;
switch (option) {
if (!graph.contains(n)) {
  graph.addNode(n);

代码示例来源: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 (Node n : mainGraph.getNodes().toArray()) {
    if (!graph.contains(n)) {
      //The node n is not in graph
      graph.addNode(n);
    } else {
      //The node n is in graph
      graph.removeNode(n);
    }
  }
  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) {
        graph.addEdge(e);
      }
    }
  }
  return graph;
}

代码示例来源: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: org.gephi/graphstore

if (nImpl != null && !graph.contains(nImpl)) {
  graphDiff.removedNodes.add(nImpl);
if (eImpl != null && !graph.contains(eImpl)) {
  graphDiff.removedEdges.add(eImpl);

代码示例来源:origin: gephi/graphstore

if (nImpl != null && !graph.contains(nImpl)) {
  graphDiff.removedNodes.add(nImpl);
if (eImpl != null && !graph.contains(eImpl)) {
  graphDiff.removedEdges.add(eImpl);

代码示例来源:origin: gephi/gephi-toolkit-demos

System.out.println("Node 3 in the filtered graph: " + filteredGraph.contains(graph.getNode("3")));

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

for (Edge e : edges) {
  for (Edge f : edges) {
    if (e != f && graph.contains(e) && graph.contains(f) && !e.isSelfLoop() && !f.isSelfLoop()) {
      Node s1 = e.getSource();
      Node t1 = e.getTarget();

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

for (int i = 0; i < nodes.length; i++) {
  NodeModel node = nodes[i];
  if (node != null && (node.getNode().getStoreId() == -1 || (isView && !graph.contains(node.getNode())))) {
  if (edge != null && (edge.getEdge().getStoreId() == -1 || (isView && !graph.contains(edge.getEdge())))) {

相关文章