Java Code Examples for com.tinkerpop.blueprints.Vertex#getVertices()
The following examples show how to use
com.tinkerpop.blueprints.Vertex#getVertices() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReachingDefinitionAnalyser.java From bjoern with GNU General Public License v3.0 | 6 votes |
private List<Vertex> getAllNodesInReversePostOrder(Vertex entry) { Deque<Vertex> stack1 = new LinkedList<>(); List<Vertex> stack2 = new LinkedList<>(); stack1.push(entry); while (!stack1.isEmpty()) { Vertex root = stack1.pop(); stack2.add(root); for (Vertex child : root.getVertices(Direction.OUT, CFLOW_LABEL)) { if (stack1.contains(child) || stack2.contains(child)) { continue; } stack1.push(child); } } return stack2; }
Example 2
Source File: TitanGraphDatabase.java From graphdb-benchmarks with Apache License 2.0 | 6 votes |
@Override public double getEdgesInsideCommunity(int vertexCommunity, int communityVertices) { double edges = 0; Iterable<Vertex> vertices = titanGraph.getVertices(NODE_COMMUNITY, vertexCommunity); Iterable<Vertex> comVertices = titanGraph.getVertices(COMMUNITY, communityVertices); for (Vertex vertex : vertices) { for (Vertex v : vertex.getVertices(Direction.OUT, SIMILAR)) { if (Iterables.contains(comVertices, v)) { edges++; } } } return edges; }
Example 3
Source File: OrientGraphDatabase.java From graphdb-benchmarks with Apache License 2.0 | 6 votes |
@Override public Set<Integer> getCommunitiesConnectedToNodeCommunities(int nodeCommunities) { Set<Integer> communities = new HashSet<Integer>(); Iterable<Vertex> vertices = graph.getVertices(NODE_COMMUNITY, nodeCommunities); for (Vertex vertex : vertices) { for (Vertex v : vertex.getVertices(Direction.OUT, SIMILAR)) { int community = v.getProperty(COMMUNITY); if (!communities.contains(community)) { communities.add(community); } } } return communities; }
Example 4
Source File: OrientGraphDatabase.java From graphdb-benchmarks with Apache License 2.0 | 6 votes |
@Override public double getEdgesInsideCommunity(int vertexCommunity, int communityVertices) { double edges = 0; Iterable<Vertex> vertices = graph.getVertices(NODE_COMMUNITY, vertexCommunity); Iterable<Vertex> comVertices = graph.getVertices(COMMUNITY, communityVertices); for (Vertex vertex : vertices) { for (Vertex v : vertex.getVertices(Direction.OUT, SIMILAR)) { if (Iterables.contains(comVertices, v)) { edges++; } } } return edges; }
Example 5
Source File: DataDependenceCreator.java From bjoern with GNU General Public License v3.0 | 5 votes |
private static Set<String> getUseSet(Vertex destination) { Set<String> set = new HashSet<>(); for (Vertex vertex : destination.getVertices(Direction.OUT, "READ")) { set.add(vertex.getProperty("name")); } return set; }
Example 6
Source File: ReachingDefinitionAnalyser.java From bjoern with GNU General Public License v3.0 | 5 votes |
private Map<Vertex, Set<Definition>> collectReachingDefinitions() { Map<Vertex, Set<Definition>> reachingDefinitions = new HashMap<>(); for (Vertex vertex : out.keySet()) { Set<Definition> definitions = new HashSet<>(); for (Vertex predecessor : vertex.getVertices(Direction.IN, CFLOW_LABEL)) { definitions.addAll(getOut(predecessor)); } reachingDefinitions.put(vertex, definitions); } return reachingDefinitions; }
Example 7
Source File: ReachingDefinitionAnalyser.java From bjoern with GNU General Public License v3.0 | 5 votes |
private Set<Definition> getIn(Vertex vertex) { Set<Definition> in = new HashSet<>(); for (Vertex predecessor : vertex.getVertices(Direction.IN, CFLOW_LABEL)) { in.addAll(getOut(predecessor)); } return in; }
Example 8
Source File: OrientGraphDatabase.java From graphdb-benchmarks with Apache License 2.0 | 5 votes |
@Override public Set<Integer> getNeighborsIds(int nodeId) { Set<Integer> neighbours = new HashSet<Integer>(); Vertex vertex = graph.getVertices(NODE_ID, nodeId).iterator().next(); for (Vertex v : vertex.getVertices(Direction.IN, SIMILAR)) { Integer neighborId = v.getProperty(NODE_ID); neighbours.add(neighborId); } return neighbours; }
Example 9
Source File: OrientGraphDatabase.java From graphdb-benchmarks with Apache License 2.0 | 4 votes |
public double getNodeInDegree(Vertex vertex) { @SuppressWarnings("rawtypes") OMultiCollectionIterator result = (OMultiCollectionIterator) vertex.getVertices(Direction.IN, SIMILAR); return (double) result.size(); }
Example 10
Source File: OrientGraphDatabase.java From graphdb-benchmarks with Apache License 2.0 | 4 votes |
public double getNodeOutDegree(Vertex vertex) { @SuppressWarnings("rawtypes") OMultiCollectionIterator result = (OMultiCollectionIterator) vertex.getVertices(Direction.OUT, SIMILAR); return (double) result.size(); }