@Override public Edge createEdge(final Object id, final Vertex out, final Vertex in, final String label) { return this.graph.addEdge(id, out, in, label); }
@Override public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) { return graph.addEdge(id, outVertex, inVertex, label); }
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; }
protected final Edge addEdge(Graph graph, Vertex out, Vertex in) { Edge e = graph.addEdge(null,out,in,label); edgeAnnotator.annotate(e); return e; }
protected final Edge addEdge(Graph graph, Vertex out, Vertex in) { Edge e = graph.addEdge(null,out,in,label); edgeAnnotator.annotate(e); return e; }
protected final Edge addEdge(Graph graph, Vertex out, Vertex in) { Edge e = graph.addEdge(null,out,in,label); edgeAnnotator.annotate(e); return e; }
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) { return config.getConfiguredGraph().addEdge(id, outVertex, inVertex, label); }
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) { return config.getConfiguredGraph().addEdge(id, outVertex, inVertex, label); }
@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); }
public boolean addEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex) { this.graph.addEdge(edge.getId(), outVertex, inVertex, edge.getLabel()); return true; }
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)); }
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; }
@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)); } }
/** * 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); } }
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);
@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; }
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; }
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; }