本文整理了Java中com.tinkerpop.blueprints.Vertex.getEdges()
方法的一些代码示例,展示了Vertex.getEdges()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getEdges()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Vertex
类名称:Vertex
方法名:getEdges
[英]Return the edges incident to the vertex according to the provided direction and edge labels.
[中]根据提供的方向和边标签返回与顶点相关的边。
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public VerticesFromEdgesIterable(final Vertex vertex, final Direction direction, final String... labels) {
this.direction = direction;
this.vertex = vertex;
this.iterable = vertex.getEdges(direction, labels);
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public int outDegree(final Vertex vertex) {
final Iterable<Edge> itty = vertex.getEdges(Direction.OUT);
if (itty instanceof Collection) {
return ((Collection) itty).size();
} else {
int count = 0;
for (final Edge edge : itty) {
count++;
}
return count;
}
}
代码示例来源:origin: socialsensor/graphdb-benchmarks
@Override
public Iterator<Edge> getNeighborsOfVertex(Vertex v)
{
return v.getEdges(Direction.BOTH, SIMILAR).iterator();
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public int inDegree(final Vertex vertex) {
final Iterable<Edge> itty = vertex.getEdges(Direction.IN);
if (itty instanceof Collection) {
return ((Collection) itty).size();
} else {
int count = 0;
for (final Edge edge : itty) {
count++;
}
return count;
}
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Collection<Edge> getIncidentEdges(final Vertex vertex) {
final Set<Edge> edges = new HashSet<Edge>();
for (final Edge edge : vertex.getEdges(Direction.IN)) {
edges.add(edge);
}
for (final Edge edge : vertex.getEdges(Direction.OUT)) {
edges.add(edge);
}
return edges;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Collection<Edge> getInEdges(final Vertex vertex) {
final Iterable<Edge> itty = vertex.getEdges(Direction.IN);
if (itty instanceof Collection) {
return (Collection<Edge>) itty;
} else {
final List<Edge> edges = new ArrayList<Edge>();
for (final Edge edge : itty) {
edges.add(edge);
}
return edges;
}
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Collection<Edge> getOutEdges(final Vertex vertex) {
final Iterable<Edge> itty = vertex.getEdges(Direction.OUT);
if (itty instanceof Collection) {
return (Collection<Edge>) itty;
} else {
final List<Edge> edges = new ArrayList<Edge>();
for (final Edge edge : itty) {
edges.add(edge);
}
return edges;
}
}
代码示例来源:origin: stackoverflow.com
Set<Object> edges = new HashSet();
for(Vertex v : orientGraph.getVertices()) {
for( Edge e : v.getEdges( Direction.BOTH ) )
edges.add( e.getIdentity() );
}
return edges.size();
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Edge findEdge(final Vertex outVertex, final Vertex inVertex) {
for (final Edge edge : outVertex.getEdges(Direction.OUT)) {
if (edge.getVertex(Direction.IN).equals(inVertex)) {
return edge;
}
}
return null;
}
代码示例来源:origin: citiususc/hipster
@Override
public Iterable<GraphEdge<Vertex, Edge>> incomingEdgesOf(Vertex vertex) {
return convertEdges(vertex.getEdges(Direction.IN));
}
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Collection<Vertex> getNeighbors(final Vertex vertex) {
final Set<Vertex> vertices = new HashSet<Vertex>();
for (final Edge e : vertex.getEdges(Direction.OUT)) {
vertices.add(e.getVertex(Direction.IN));
}
for (final Edge e : vertex.getEdges(Direction.IN)) {
vertices.add(e.getVertex(Direction.OUT));
}
return vertices;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Collection<Vertex> getSuccessors(final Vertex vertex) {
final Set<Vertex> vertices = new HashSet<Vertex>();
for (final Edge edge : vertex.getEdges(Direction.OUT)) {
vertices.add(edge.getVertex(Direction.IN));
}
return vertices;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public boolean isPredecessor(final Vertex outVertex, final Vertex inVertex) {
for (final Edge edge : outVertex.getEdges(Direction.IN)) {
if (edge.getVertex(Direction.OUT).equals(inVertex))
return true;
}
return false;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public Collection<Edge> findEdgeSet(final Vertex outVertex, final Vertex inVertex) {
final Set<Edge> edges = new HashSet<Edge>();
for (final Edge edge : outVertex.getEdges(Direction.OUT)) {
if (edge.getVertex(Direction.IN).equals(inVertex)) {
edges.add(edge);
}
}
return edges;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung
public boolean isNeighbor(final Vertex outVertex, final Vertex inVertex) {
for (final Edge edge : outVertex.getEdges(Direction.OUT)) {
if (edge.getVertex(Direction.IN).equals(inVertex))
return true;
}
for (final Edge edge : outVertex.getEdges(Direction.IN)) {
if (edge.getVertex(Direction.OUT).equals(inVertex))
return true;
}
return false;
}
代码示例来源:origin: citiususc/hipster
@Override
public Iterable<GraphEdge<Vertex, Edge>> outgoingEdgesOf(Vertex vertex) {
return convertEdges(vertex.getEdges(Direction.OUT));
}
代码示例来源:origin: com.tinkerpop/pipes
protected Edge processNextStart() {
while (true) {
if (this.nextEnds.hasNext()) {
return this.nextEnds.next();
} else {
this.nextEnds = this.doBranchFactor ?
this.starts.next().query().direction(this.direction).labels(this.labels).limit(this.branchFactor).edges().iterator() :
this.starts.next().getEdges(this.direction, this.labels).iterator();
}
}
}
代码示例来源:origin: gentics/mesh
private void migrateContainer(Vertex nodeContainer) {
Iterator<Edge> it = nodeContainer.getEdges(OUT, "HAS_LANGUAGE").iterator();
if (!it.hasNext()) {
// We skip containers which have no language set. Those need to be cleaned using the consistency check.
return;
}
Edge languageEdge = it.next();
String languageTag = languageEdge
.getVertex(IN).getProperty("languageTag");
nodeContainer.setProperty("languageTag", languageTag);
languageEdge.remove();
}
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) {
for (final Edge edge : element.getEdges(direction, label)) {
if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) {
framedGraph.removeEdge(edge);
}
}
}
}
代码示例来源:origin: org.hawkular.titan/titan-test
public static void assertGraphOfTheGods(TitanGraph gotg) {
assertEquals(12,Iterables.size(gotg.getVertices()));
assertEquals(3,Iterables.size(gotg.getVertices("label","god")));
Vertex h = Iterables.getOnlyElement(gotg.getVertices("name","hercules"));
assertEquals(30,h.getProperty("age"));
assertEquals("demigod",((TitanVertex)h).getLabel());
assertEquals(5,Iterables.size(h.getEdges(Direction.BOTH)));
gotg.commit();
}
内容来源于网络,如有侵权,请联系作者删除!