@Test public void testVertexInducedSubgraph() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); loader.appendToDatabaseFromString("expected:_DB[" + "(databases)<-[ghtd]-(gdbs)-[ghtg1]->(graphs)" + "(graphs)<-[ghtg2]-(gps)-[ghth]->(hadoop)" + "]"); LogicalGraph input = loader.getLogicalGraph(); LogicalGraph expected = loader.getLogicalGraphByVariable("expected"); LogicalGraph output = input.vertexInducedSubgraph( v -> v.getLabel().equals("Forum") || v.getLabel().equals("Tag")); collectAndAssertTrue(output.equalsByData(expected)); }
private LG vertexInducedSubgraph(LG superGraph) { DataSet<V> filteredVertices = superGraph.getVertices().filter(vertexFilterFunction); return superGraph.getFactory() .fromDataSets(superGraph.getGraphHead(), filteredVertices, superGraph.getEdges()) .verify(); }
Subgraph implements UnaryBaseGraphToBaseGraphOperator<LG> { private LG vertexInducedSubgraph(LG superGraph) { DataSet<V> filteredVertices = superGraph.getVertices().filter(vertexFilterFunction); return superGraph.getFactory() .fromDataSets(superGraph.getGraphHead(), filteredVertices, superGraph.getEdges()) .verify(); } }
Subgraph implements UnaryBaseGraphToBaseGraphOperator<LG> { private LG vertexInducedSubgraph(LG superGraph) { DataSet<V> filteredVertices = superGraph.getVertices().filter(vertexFilterFunction); return superGraph.getFactory() .fromDataSets(superGraph.getGraphHead(), filteredVertices, superGraph.getEdges()) .verify(); } Subgraph(FilterFunction<V> vertexFilterFunction,
    FilterFunction<E> edgeFilterFunction, Strategy strategy); }
Subgraph implements UnaryBaseGraphToBaseGraphOperator<LG> { private LG vertexInducedSubgraph(LG superGraph) { DataSet<V> filteredVertices = superGraph.getVertices().filter(vertexFilterFunction); return superGraph.getFactory() .fromDataSets(superGraph.getGraphHead(), filteredVertices, superGraph.getEdges()) .verify(); } Subgraph(FilterFunction<V> vertexFilterFunction,
    FilterFunction<E> edgeFilterFunction, Strategy strategy); @Override LG execute(LG superGraph); }
Subgraph implements UnaryBaseGraphToBaseGraphOperator<LG> { private LG vertexInducedSubgraph(LG superGraph) { DataSet<V> filteredVertices = superGraph.getVertices().filter(vertexFilterFunction); return superGraph.getFactory() .fromDataSets(superGraph.getGraphHead(), filteredVertices, superGraph.getEdges()) .verify(); } Subgraph(FilterFunction<V> vertexFilterFunction,
    FilterFunction<E> edgeFilterFunction, Strategy strategy); @Override LG execute(LG superGraph);  }