本文整理了Java中org.gephi.graph.api.Edge.getTarget()
方法的一些代码示例,展示了Edge.getTarget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge.getTarget()
方法的具体详情如下:
包路径:org.gephi.graph.api.Edge
类名称:Edge
方法名:getTarget
[英]Returns the edge's target.
[中]返回边的目标。
代码示例来源:origin: org.gephi/desktop-datalab
@Override
public Object getValueFor(Edge edge) {
if (showEdgesNodesLabels) {
return edge.getTarget().getId() + " - " + edge.getTarget().getLabel();
} else {
return edge.getTarget().getId();
}
}
};
代码示例来源: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: 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: 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/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/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/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.getTarget();
VizController.getInstance().getSelectionManager().centerOnNode(source);
}
代码示例来源:origin: org.gephi/statistics-plugin
private HashMap<Node, EdgeWrapper> createNeighbourTable(Graph graph, Node node, HashMap<Node, Integer> indicies,
ArrayWrapper[] networks, boolean directed) {
HashMap<Node, EdgeWrapper> neighborTable = new HashMap<>();
if (!directed) {
for (Edge edge : graph.getEdges(node)) {
Node neighbor = graph.getOpposite(node, edge);
neighborTable.put(neighbor, new EdgeWrapper(1, networks[indicies.get(neighbor)]));
}
} else {
for (Node neighbor : ((DirectedGraph) graph).getPredecessors(node)) {
neighborTable.put(neighbor, new EdgeWrapper(1, networks[indicies.get(neighbor)]));
}
for (Edge out : ((DirectedGraph) graph).getOutEdges(node)) {
Node neighbor = out.getTarget();
EdgeWrapper ew = neighborTable.get(neighbor);
if (ew == null) {
neighborTable.put(neighbor, new EdgeWrapper(1, network[indicies.get(neighbor)]));
} else {
ew.count++;
}
}
}
return neighborTable;
}
代码示例来源: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/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/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/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;
}
内容来源于网络,如有侵权,请联系作者删除!