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

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

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

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

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

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

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

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

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

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

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

  1. public final Node getPredecessor(Node node) {
  2. Edge edge = getPredecessors().get(node);
  3. if (edge != null) {
  4. if (edge.getSource() != node) {
  5. return edge.getSource();
  6. } else {
  7. return edge.getTarget();
  8. }
  9. }
  10. return null;
  11. }

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

  1. @Override
  2. public Object getValueFor(Edge edge) {
  3. if (showEdgesNodesLabels) {
  4. return edge.getSource().getId() + " - " + edge.getSource().getLabel();
  5. } else {
  6. return edge.getSource().getId();
  7. }
  8. }
  9. };

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

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

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

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

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

  1. protected boolean relax(Edge edge) {
  2. Node source = edge.getSource();
  3. Node target = edge.getTarget();
  4. double distSource = distances.get(source);
  5. double distTarget = distances.get(target);
  6. double weight = edgeWeight(edge);
  7. double sourceWeight = distSource + weight;
  8. if (sourceWeight < distTarget) {
  9. distances.put(target, sourceWeight);
  10. maxDistance = Math.max(maxDistance, sourceWeight);
  11. return true;
  12. } else {
  13. return false;
  14. }
  15. }

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

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

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

  1. @Override
  2. public boolean evaluate(Graph graph, Edge edge) {
  3. Object srcValue = partition.getValue(edge.getSource(), graph);
  4. Object destValue = partition.getValue(edge.getTarget(), graph);
  5. srcValue = srcValue == null ? NULL : srcValue;
  6. destValue = destValue == null ? NULL : destValue;
  7. return parts.contains(srcValue) && parts.contains(destValue) && !srcValue.equals(destValue);
  8. }
  9. }

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

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

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

  1. public float getAverageEdgeLength(Graph graph) {
  2. float edgeLength = 0;
  3. int count = 1;
  4. for (Edge e : graph.getEdges()) {
  5. edgeLength += ForceVectorUtils.distance(
  6. e.getSource(), e.getTarget());
  7. count++;
  8. }
  9. return edgeLength / count;
  10. }

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

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

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

  1. @Override
  2. public void deleteEdgeWithNodes(Edge edge, boolean deleteSource, boolean deleteTarget) {
  3. if (deleteSource) {
  4. deleteNode(edge.getSource());
  5. }
  6. if (deleteTarget) {
  7. deleteNode(edge.getTarget());
  8. }
  9. removeEdge(edge, getCurrentGraph());//If no node is deleted, we need to remove the edge.
  10. }

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

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

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

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

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

  1. @Override
  2. public void execute() {
  3. VizController.getInstance().getSelectionManager().selectEdges(edges);
  4. VizController.getInstance().getSelectionManager().centerOnNode(clickedEdge.getSource());
  5. }

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

  1. public Helper(final Item item) {
  2. node = ((Edge) item.getSource()).getSource();
  3. Item nodeSource = item.getData(SOURCE);
  4. x = nodeSource.getData(NodeItem.X);
  5. y = nodeSource.getData(NodeItem.Y);
  6. Float size = nodeSource.getData(NodeItem.SIZE);
  7. v1 = new Vector(x, y);
  8. v1.add(size, -size);
  9. v2 = new Vector(x, y);
  10. v2.add(size, size);
  11. }
  12. }

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

  1. @Override
  2. public Graph filter(Subgraph[] graphs) {
  3. if (graphs.length > 1) {
  4. throw new IllegalArgumentException("Not Filter accepts a single graph in parameter");
  5. }
  6. Graph graph = graphs[0];
  7. Graph mainGraph = graph.getView().getGraphModel().getGraph();
  8. for (Edge e : mainGraph.getEdges()) {
  9. Node source = e.getSource();
  10. Node target = e.getTarget();
  11. if (graph.contains(source) && graph.contains(target)) {
  12. Edge edgeInGraph = graph.getEdge(source, target, e.getType());
  13. if (edgeInGraph == null) {
  14. //The edge is not in graph
  15. graph.addEdge(e);
  16. } else {
  17. //The edge is in the graph
  18. graph.removeEdge(edgeInGraph);
  19. }
  20. }
  21. }
  22. return graph;
  23. }

相关文章