14.5.6 Creating a Subgraph
PGX provides the following methods for creating subgraphs via a filter (see Filter Expressions for more information) expression:
PgxGraph filter(GraphFilter graphFilter)
PgxGraph filter(GraphFilter graphFilter, String newGraphName)
PgxGraph filter(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, GraphFilter graphFilter, String newGraphName)filter(self, graph_filter, vertex_properties=True, edge_properties=True, name=None)As in the other graph mutating methods, the user has the option to
specify the name of the subgraph with the newGraphName parameter
and of choosing the vertex and edge properties to be copied into the subgraph
(vertexProps and edgeProps). All of the
preceding methods return a PgxGraph object which represents the
created subgraph.
All filter methods require a GraphFilter argument
containing a filter expression. Fundamentally, the filter expression is a Boolean
expression that is evaluated for every vertex and edge in the original graph (in
parallel). If the expression is evaluated as true for the vertex or
edge, then that vertex or edge is included in the subgraph.
See Creating Subgraphs for more information on how to create subgraphs from graphs loaded into memory.
Parent topic: Graph Mutation and Subgraphs