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

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

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

Edge.getSource介绍

[英]Returns the egde's source.
[中]返回egde的源。

代码示例

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

@Override
public Node next() {
  Edge e = itr.next();
  return e.getSource() == node ? e.getTarget() : e.getSource();
}

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

@Override
public Node next() {
  Edge e = itr.next();
  return e.getSource() == node ? e.getTarget() : e.getSource();
}

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

@Override
public Node next() {
  Edge e = itr.next();
  return e.getSource() == node ? e.getTarget() : e.getSource();
}

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

@Override
public Node next() {
  Edge e = itr.next();
  return e.getSource() == node ? e.getTarget() : e.getSource();
}

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

public final Node getPredecessor(Node node) {
  Edge edge = getPredecessors().get(node);
  if (edge != null) {
    if (edge.getSource() != node) {
      return edge.getSource();
    } else {
      return edge.getTarget();
    }
  }
  return null;
}

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

@Override
  public Object getValueFor(Edge edge) {
    if (showEdgesNodesLabels) {
      return edge.getSource().getId() + " - " + edge.getSource().getLabel();
    } else {
      return edge.getSource().getId();
    }
  }
};

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

@Override
public Node getOpposite(final Node node, final Edge edge) {
  nodeStore.checkNonNullNodeObject(node);
  edgeStore.checkNonNullEdgeObject(edge);
  return edge.getSource() == node ? edge.getTarget() : edge.getSource();
}

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

@Override
public Node getOpposite(final Node node, final Edge edge) {
  nodeStore.checkNonNullNodeObject(node);
  edgeStore.checkNonNullEdgeObject(edge);
  return edge.getSource() == node ? edge.getTarget() : edge.getSource();
}

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

protected boolean relax(Edge edge) {
  Node source = edge.getSource();
  Node target = edge.getTarget();
  double distSource = distances.get(source);
  double distTarget = distances.get(target);
  double weight = edgeWeight(edge);
  double sourceWeight = distSource + weight;
  if (sourceWeight < distTarget) {
    distances.put(target, sourceWeight);
    maxDistance = Math.max(maxDistance, sourceWeight);
    return true;
  } else {
    return false;
  }
}

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

@Override
public boolean evaluate(Graph graph, Edge edge) {
  Object srcValue = partition.getValue(edge.getSource(), graph);
  Object destValue = partition.getValue(edge.getTarget(), graph);
  srcValue = srcValue == null ? NULL : srcValue;
  destValue = destValue == null ? NULL : destValue;
  return parts.contains(srcValue) && parts.contains(destValue) && srcValue.equals(destValue);
}

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

@Override
  public boolean evaluate(Graph graph, Edge edge) {
    Object srcValue = partition.getValue(edge.getSource(), graph);
    Object destValue = partition.getValue(edge.getTarget(), graph);
    srcValue = srcValue == null ? NULL : srcValue;
    destValue = destValue == null ? NULL : destValue;
    return parts.contains(srcValue) && parts.contains(destValue) && !srcValue.equals(destValue);
  }
}

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

@Override
public void execute() {
  Node[] nodes=new Node[]{clickedEdge.getSource(),clickedEdge.getTarget()};
  DataTablesController dtc=Lookup.getDefault().lookup(DataTablesController.class);
  dtc.setNodeTableSelection(nodes);
  dtc.selectNodesTable();
}

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

public float getAverageEdgeLength(Graph graph) {
  float edgeLength = 0;
  int count = 1;
  for (Edge e : graph.getEdges()) {
    edgeLength += ForceVectorUtils.distance(
        e.getSource(), e.getTarget());
    count++;
  }
  return edgeLength / count;
}

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

@Override
public void execute() {
  Node source = clickedEdge.getSource();
  VizController.getInstance().getSelectionManager().centerOnNode(source);
}

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

@Override
public void deleteEdgeWithNodes(Edge edge, boolean deleteSource, boolean deleteTarget) {
  if (deleteSource) {
    deleteNode(edge.getSource());
  }
  if (deleteTarget) {
    deleteNode(edge.getTarget());
  }
  removeEdge(edge, getCurrentGraph());//If no node is deleted, we need to remove the edge.
}

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

private EdgeImpl verifyEdge(Edge edge) {
  EdgeImpl edgeImpl = (EdgeImpl) edge;
  verifyElement(edgeImpl);
  EdgeImpl existingEdge = store.getEdge(edge.getId());
  if (existingEdge != null && (!existingEdge.getSource().getId().equals(edge.getSource().getId()) || !existingEdge
      .getTarget().getId().equals(edge.getTarget().getId()))) {
    throw new RuntimeException("An edge with a similar id '" + edge.getId() + "' already exists");
  }
  return edgeImpl;
}

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

private EdgeImpl verifyEdge(Edge edge) {
  EdgeImpl edgeImpl = (EdgeImpl) edge;
  verifyElement(edgeImpl);
  EdgeImpl existingEdge = store.getEdge(edge.getId());
  if (existingEdge != null && (!existingEdge.getSource().getId().equals(edge.getSource().getId()) || !existingEdge
      .getTarget().getId().equals(edge.getTarget().getId()))) {
    throw new RuntimeException("An edge with a similar id '" + edge.getId() + "' already exists");
  }
  return edgeImpl;
}

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

@Override
public void execute() {
  VizController.getInstance().getSelectionManager().selectEdges(edges);
  VizController.getInstance().getSelectionManager().centerOnNode(clickedEdge.getSource());
}

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

public Helper(final Item item) {
    node = ((Edge) item.getSource()).getSource();
    Item nodeSource = item.getData(SOURCE);
    x = nodeSource.getData(NodeItem.X);
    y = nodeSource.getData(NodeItem.Y);
    Float size = nodeSource.getData(NodeItem.SIZE);
    v1 = new Vector(x, y);
    v1.add(size, -size);
    v2 = new Vector(x, y);
    v2.add(size, size);
  }
}

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

相关文章