本文整理了Java中com.tinkerpop.blueprints.Graph.addEdge()
方法的一些代码示例,展示了Graph.addEdge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.addEdge()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Graph
类名称:Graph
方法名:addEdge
[英]Add an edge to the graph. The added edges requires a recommended identifier, a tail vertex, an head vertex, and a label. Like adding a vertex, the provided object identifier may be ignored by the implementation.
[中]将边添加到图形中。添加的边需要推荐的标识符、尾部顶点、头部顶点和标签。与添加顶点一样,提供的对象标识符可能会被实现忽略。
代码示例来源:origin: stackoverflow.com
Graph g1,g2;
g1 = new GraphAdjList();
g2 = new GraphAdjMatrix();
g1.addEdge(1,2);
g2.addEdge(1,2);
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
@Override
public Edge createEdge(final Object id, final Vertex out, final Vertex in, final String label) {
return this.graph.addEdge(id, out, in, label);
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
@Override
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
return graph.addEdge(id, outVertex, inVertex, label);
}
代码示例来源:origin: stackoverflow.com
public static Graph karyTree(Graph g, int V, int k) {
int[] vertices = new int[(int)Math.pow(V, k)];
for (int i = 0; i < (int)Math.pow(V, k); i++) vertices[i] = i;
for (int i = 1; i < (int)Math.pow(V, k); i++) {
g.addEdge("ax" + returnRandom(0,100000000), "a"+vertices[i],"a"+vertices[(i-1)/k]);
}
return g;
}
代码示例来源:origin: tinkerpop/furnace
protected final Edge addEdge(Graph graph, Vertex out, Vertex in) {
Edge e = graph.addEdge(null,out,in,label);
edgeAnnotator.annotate(e);
return e;
}
代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6
protected final Edge addEdge(Graph graph, Vertex out, Vertex in) {
Edge e = graph.addEdge(null,out,in,label);
edgeAnnotator.annotate(e);
return e;
}
代码示例来源:origin: org.hawkular.titan/titan-test
protected final Edge addEdge(Graph graph, Vertex out, Vertex in) {
Edge e = graph.addEdge(null,out,in,label);
edgeAnnotator.annotate(e);
return e;
}
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
public Edge addEdge(final Object id, final Vertex outVertex,
final Vertex inVertex, final String label) {
return config.getConfiguredGraph().addEdge(id, outVertex, inVertex, label);
}
代码示例来源:origin: com.tinkerpop/frames
public Edge addEdge(final Object id, final Vertex outVertex,
final Vertex inVertex, final String label) {
return config.getConfiguredGraph().addEdge(id, outVertex, inVertex, label);
}
代码示例来源:origin: tinkerpop/furnace
@Override
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
return new DerivedEdge(this.baseGraph.addEdge(id, outVertex, inVertex, label), this);
}
代码示例来源:origin: stackoverflow.com
Graph graph = new SingleGraph("Tutorial 1");
graph.setStrict(false);
graph.setAutoCreate(true); // optionally have it create nodes for you automatically
graph.addEdge("AB", "A", "B");
graph.addEdge("BC", "B", "C");
graph.addEdge("CA", "C", "A");
graph.display();
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public boolean addEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex) {
this.graph.addEdge(edge.getId(), outVertex, inVertex, edge.getLabel());
return true;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
return new WrappedEdge(this.baseGraph.addEdge(id, ((WrappedVertex) outVertex).getBaseVertex(), ((WrappedVertex) inVertex).getBaseVertex(), label));
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
final PartitionEdge edge = new PartitionEdge(this.baseGraph.addEdge(id, ((PartitionVertex) outVertex).getBaseVertex(), ((PartitionVertex) inVertex).getBaseVertex(), label), this);
edge.setPartition(this.writePartition);
return edge;
}
代码示例来源:origin: kieker-monitoring/kieker
@Override
protected void transformEdge(final IEdge edge) {
final com.tinkerpop.blueprints.Vertex mappedInVertex = this.mappedVertices.get(edge.getVertex(Direction.IN));
final com.tinkerpop.blueprints.Vertex mappedOutVertex = this.mappedVertices.get(edge.getVertex(Direction.OUT));
String label = edge.getProperty(LABEL_PROPERTY);
if (label == null) {
label = "";
}
final com.tinkerpop.blueprints.Edge mappedEdge = this.transformedGraph.addEdge(edge.getId(), mappedOutVertex, mappedInVertex, label);
for (final String propertyKey : edge.getPropertyKeys()) {
mappedEdge.setProperty(propertyKey, edge.getProperty(propertyKey));
}
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
/**
* Edges are relabeled by creating new edges with the same properties, but new label.
* Note that for each edge is deleted and an edge is added.
*
* @param graph the graph to add the new edge to
* @param oldEdges the existing edges to "relabel"
* @param newLabel the label of the new edge
*/
public static void relabelEdges(final Graph graph, final Iterable<Edge> oldEdges, final String newLabel) {
for (final Edge oldEdge : oldEdges) {
final Vertex outVertex = oldEdge.getVertex(Direction.OUT);
final Vertex inVertex = oldEdge.getVertex(Direction.IN);
final Edge newEdge = graph.addEdge(null, outVertex, inVertex, newLabel);
ElementHelper.copyProperties(oldEdge, newEdge);
graph.removeEdge(oldEdge);
}
}
代码示例来源:origin: stackoverflow.com
Graph graph = new Graph();
graph.getNodeTable().addColumn("duration", double.class);
Node n1 = graph.addNode();
n1.setDouble("duration", 20.0);
Node n2 = graph.addNode();
Edge e = graph.addEdge(n1, n2);
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public boolean add(Atom atom) {
Vertex atomVertex = graph.addVertex(null);
atomVertex.setProperty("class", "atom");
atomVertex.setProperty("predicate",
predicateToString(atom.getPredicate()));
Vertex predicateVertex = this.add(atom.getPredicate());
this.graph.addEdge(null, atomVertex, predicateVertex, "predicate");
int i = 0;
for (Term t : atom) {
atomVertex.setProperty("term" + i, termToString(t));
Vertex termVertex = this.add(t);
Edge e = graph.addEdge(null, atomVertex, termVertex, "term");
e.setProperty("index", i++);
}
return true;
}
代码示例来源:origin: SciGraph/SciGraph
Edge addEdge(Relationship relationship) {
Edge edge = graph.getEdge(relationship.getId());
if (null == edge) {
Vertex outVertex = addNode(relationship.getStartNode());
Vertex inVertex = addNode(relationship.getEndNode());
String label = relationship.getType().name();
Optional<String> curieLabel = curieUtil.getCurie(label);
edge = graph.addEdge(relationship.getId(), outVertex, inVertex, curieLabel.orElse(label));
copyProperties(relationship, edge);
}
return edge;
}
代码示例来源:origin: SciGraph/SciGraph
Edge addEdge(Edge edge) {
Edge newEdge = graph.getEdge(edge.getId());
if (null == newEdge) {
Vertex outVertex = addNode(edge.getVertex(Direction.OUT));
Vertex inVertex = addNode(edge.getVertex(Direction.IN));
String label = edge.getLabel();
newEdge = graph.addEdge(edge.getId(), outVertex, inVertex, label);
copyProperties(edge, edge);
}
return newEdge;
}
内容来源于网络,如有侵权,请联系作者删除!