public TinkerGraphComputerView(final TinkerGraph graph, final GraphFilter graphFilter, final Set<VertexComputeKey> computeKeys) { this.graph = graph; this.computeKeys = new HashMap<>(); computeKeys.forEach(key -> this.computeKeys.put(key.getKey(), key)); this.computeProperties = new ConcurrentHashMap<>(); this.graphFilter = graphFilter; if (this.graphFilter.hasFilter()) { graph.vertices().forEachRemaining(vertex -> { boolean legalVertex = false; if (this.graphFilter.hasVertexFilter() && this.graphFilter.legalVertex(vertex)) { this.legalVertices.add(vertex.id()); legalVertex = true; } if ((legalVertex || !this.graphFilter.hasVertexFilter()) && this.graphFilter.hasEdgeFilter()) { final Set<Object> edges = new HashSet<>(); this.legalEdges.put(vertex.id(), edges); this.graphFilter.legalEdges(vertex).forEachRemaining(edge -> edges.add(edge.id())); } }); } }
final Map<String, List<Edge>> outEdges = new HashMap<>(); final Map<String, List<Edge>> inEdges = new HashMap<>(); graphFilter.legalEdges(this).forEachRemaining(edge -> { if (edge instanceof StarGraph.StarOutEdge) { List<Edge> edges = outEdges.get(edge.label());
public TinkerGraphComputerView(final TinkerGraph graph, final GraphFilter graphFilter, final Set<VertexComputeKey> computeKeys) { this.graph = graph; this.computeKeys = new HashMap<>(); computeKeys.forEach(key -> this.computeKeys.put(key.getKey(), key)); this.computeProperties = new ConcurrentHashMap<>(); this.graphFilter = graphFilter; if (this.graphFilter.hasFilter()) { graph.vertices().forEachRemaining(vertex -> { boolean legalVertex = false; if (this.graphFilter.hasVertexFilter() && this.graphFilter.legalVertex(vertex)) { this.legalVertices.add(vertex.id()); legalVertex = true; } if ((legalVertex || !this.graphFilter.hasVertexFilter()) && this.graphFilter.hasEdgeFilter()) { final Set<Object> edges = new HashSet<>(); this.legalEdges.put(vertex.id(), edges); this.graphFilter.legalEdges(vertex).forEachRemaining(edge -> edges.add(edge.id())); } }); } }
public TinkerGraphComputerView(final TinkerGraph graph, final GraphFilter graphFilter, final Set<VertexComputeKey> computeKeys) { this.graph = graph; this.computeKeys = new HashMap<>(); computeKeys.forEach(key -> this.computeKeys.put(key.getKey(), key)); this.computeProperties = new ConcurrentHashMap<>(); this.graphFilter = graphFilter; if (this.graphFilter.hasFilter()) { graph.vertices().forEachRemaining(vertex -> { boolean legalVertex = false; if (this.graphFilter.hasVertexFilter() && this.graphFilter.legalVertex(vertex)) { this.legalVertices.add(vertex.id()); legalVertex = true; } if ((legalVertex || !this.graphFilter.hasVertexFilter()) && this.graphFilter.hasEdgeFilter()) { final Set<Object> edges = new HashSet<>(); this.legalEdges.put(vertex.id(), edges); this.graphFilter.legalEdges(vertex).forEachRemaining(edge -> edges.add(edge.id())); } }); } }
final Map<String, List<Edge>> outEdges = new HashMap<>(); final Map<String, List<Edge>> inEdges = new HashMap<>(); graphFilter.legalEdges(this).forEachRemaining(edge -> { if (edge instanceof StarGraph.StarOutEdge) { List<Edge> edges = outEdges.get(edge.label());