本文整理了Java中org.gephi.graph.api.Edge
类的一些代码示例,展示了Edge
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge
类的具体详情如下:
包路径:org.gephi.graph.api.Edge
类名称:Edge
[英]An edge.
[中]边缘。
代码示例来源:origin: org.gephi/graphstore
@Override
public Node next() {
Edge e = itr.next();
return e.getSource() == node ? e.getTarget() : e.getSource();
}
代码示例来源:origin: org.gephi/layout-plugin
private double getEdgeWeight(Edge edge, boolean isDynamicWeight, Interval interval) {
if (isDynamicWeight) {
return edge.getWeight(interval);
} else {
return edge.getWeight();
}
}
代码示例来源:origin: org.gephi/filters-plugin
@Override
public boolean evaluate(Graph graph, Edge edge) {
return !edge.isSelfLoop();
}
代码示例来源:origin: org.gephi/graphstore
private void copyEdgeProperties(Edge edge, Edge edgeCopy) {
edgeCopy.setColor(edge.getColor());
edgeCopy.setLabel(edge.getLabel());
}
代码示例来源:origin: gephi/gephi-plugins-bootcamp
@Override
public boolean evaluate(Graph graph, Edge edge) {
DirectedGraph directedGraph = (DirectedGraph) graph;
//Make sure the edge is not self loop
if (!edge.isSelfLoop()) {
//Get the potential mutual edge
Edge mutualEdge = directedGraph.getMutualEdge(edge);
//Remove the mutual edge if exists
//Make sure only one of the two mutual edges will be removed
if (mutualEdge != null && mutualEdge.getStoreId() < edge.getStoreId()) {
return false;
}
}
return true;
}
代码示例来源:origin: gephi/gephi-plugins-bootcamp
String sourceId = e.getSource().getId().toString();
String targetId = e.getTarget().getId().toString();
String weight = String.valueOf(e.getWeight());
statement.executeUpdate("insert into edges values('" + sourceId + "', '" + targetId + "', '" + weight + "')");
if (cancel) {
代码示例来源:origin: org.gephi/statistics-plugin
double totalOutWeight = 0;
for (Edge e : directedGraph.getEdges(n)) {
if (e.getSource().equals(n)) {
totalOutWeight += e.getWeight();
if (e.getTarget().equals(n)) {
totalInWeight += e.getWeight();
} else {
for (Edge e : graph.getEdges(n)) {
totalWeight += (e.isSelfLoop() ? 2 : 1) * e.getWeight();
代码示例来源:origin: org.gephi/datalab-api
Node newEdgeSource;
Node newEdgeTarget;
if (edge.getSource() == node) {
newEdgeSource = newNode;
if (nodesSet.contains(edge.getTarget())) {
newEdgeTarget = edge.getTarget();
if (nodesSet.contains(edge.getSource())) {
newEdgeSource = edge.getSource();
newEdge = createEdge(newEdgeSource, newEdgeTarget, edge.isDirected(), edge.getTypeLabel(), graph);
Object value = edge.getAttribute(column);
if (value == null) {
newEdge.removeAttribute(column);
} else {
newEdge.setAttribute(column, edge.getAttribute(column));
代码示例来源:origin: org.gephi/visualization
float x1 = edge.getSource().x();
float x2 = edge.getTarget().x();
float y1 = edge.getSource().y();
float y2 = edge.getTarget().y();
float t1 = w;
float t2 = w;
float g;
float b;
float a = edge.alpha();
if (a == 0f) {
if (vizModel.isEdgeHasUniColor()) {
b = uni[2];
a = uni[3];
} else if (edge.isDirected()) {
Node source = edge.getSource();
r = source.r();
g = source.g();
a = source.alpha();
} else {
Node source = edge.getSource();
Node target = edge.getTarget();
r = edge.r();
g = edge.g();
b = edge.b();
代码示例来源: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
boolean t = edgeBitVector.get(e.getStoreId());
if (t && (!nodeBitVector.get(e.getSource().getStoreId()) || !nodeBitVector.get(e.getTarget()
.getStoreId()))) {
removeEdge((EdgeImpl) e);
代码示例来源:origin: org.gephi/datalab-api
if (edge.isDirected() != directed) {
sameEdgeDefinition = false;
} else {
if (directed) {
if (edge.getSource() != source || edge.getTarget() != target) {
sameEdgeDefinition = false;
if (edge.getSource() == source) {
if (edge.getTarget() != target) {
sameEdgeDefinition = false;
} else if (edge.getTarget() == source) {
if (edge.getSource() != target) {
sameEdgeDefinition = false;
id,
source.getId(), target.getId(), directed,
edge.getSource().getId(), edge.getTarget().getId(), edge.isDirected()
if (edge != null && edge.isDirected() != directed) {
代码示例来源: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
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();
Node s2 = f.getSource();
Node t2 = f.getTarget();
double s1x = s1.x();
double s1y = s1.y();
代码示例来源:origin: org.gephi/visualization
if (edge != null && (edge.getEdge().getStoreId() == -1 || (isView && !graph.contains(edge.getEdge())))) {
int sourceId = edge.getEdge().getSource().getStoreId();
int targetId = edge.getEdge().getTarget().getStoreId();
NodeModel sourceModel = sourceId == -1 ? null : nodes[sourceId];
NodeModel targetModel = targetId == -1 ? null : nodes[targetId];
float maxWeight = Float.MIN_VALUE;
for (Edge edge : graph.getEdges()) {
int id = edge.getStoreId();
EdgeModel model;
if (id >= edges.length || edges[id] == null) {
growEdges(id);
NodeModel sourceModel = nodes[edge.getSource().getStoreId()];
NodeModel targetModel = nodes[edge.getTarget().getStoreId()];
model = edgeModeler.initModel(edge, sourceModel, targetModel);
sourceModel.addEdge(model);
model = edges[id];
float w = (float) edge.getWeight(graphView);
model.setWeight(w);
minWeight = Math.min(w, minWeight);
代码示例来源:origin: org.gephi/preview-plugin
@Override
public Item[] getItems(Graph graph) {
EdgeItem[] items = new EdgeItem[graph.getEdgeCount()];
int i = 0;
for (Edge e : graph.getEdges()) {
EdgeItem item = new EdgeItem(e);
item.setData(EdgeItem.WEIGHT, e.getWeight(graph.getView()));
item.setData(EdgeItem.DIRECTED, e.isDirected());
if (graph.isDirected(e)) {
item.setData(EdgeItem.MUTUAL, ((DirectedGraph) graph).getMutualEdge(e) != null);
}
item.setData(EdgeItem.SELF_LOOP, e.isSelfLoop());
item.setData(EdgeItem.COLOR, e.alpha() == 0 ? null : e.getColor());
items[i++] = item;
}
return items;
}
代码示例来源: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: org.gephi/visualization
Node node = edge.getSource();
float x = node.x();
float y = node.y();
float g;
float b;
float a = edge.alpha();
if (vizModel.isEdgeHasUniColor()) {
float[] uni = vizModel.getEdgeUniColor();
a = uni[3];
} else if (a == 0f) {
Node source = edge.getSource();
r = source.r();
g = source.g();
a = source.alpha();
} else {
g = edge.g();
b = edge.b();
r = edge.r();
a = edge.alpha();
r = edge.r();
g = edge.g();
b = edge.b();
if (edge.alpha() == 0f) {
Node source = edge.getSource();
代码示例来源:origin: org.gephi/graphstore
@Override
public boolean isDirected(Edge edge) {
return edge.isDirected();
}
代码示例来源: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();
}
}
};
内容来源于网络,如有侵权,请联系作者删除!