15.5.7 Creating a Bipartite Subgraph
The graph server (PGX) enables the client to create a bipartite subgraph. The following methods return the created BipartiteGraph
instance:
BipartiteGraph bipartiteSubGraphFromLeftSet(VertexSet<?> vertexSet) BipartiteGraph bipartiteSubGraphFromLeftSet(VertexSet<?> vertexSet, String newGraphName) BipartiteGraph bipartiteSubGraphFromLeftSet(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, VertexSet<?> vertexSet, String newGraphName) BipartiteGraph bipartiteSubGraphFromLeftSet(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, VertexSet<?> vertexSet, String newGraphName, String isLeftPropName)
bipartite_sub_graph_from_left_set(self, vset, vertex_properties=True, edge_properties=True, name=None, is_left_name=None)
These methods require an additional argument vertexSet
, which points to a set of vertices (see Using Collections and Maps for more information) whose elements (vertices) would contain the left vertices (that is, vertices on the left side of the bipartite graph that have only edges to vertices on the right side) in the resulting bipartite graph.
When creating the bipartite subgraph, PGX automatically inserts an additional boolean
vertex property isLeft
. The value of this property is set true
for the left vertices and false
for the right vertices in the bipartite subgraph. The name of the isLeft
vertex property can be obtained with getIsLeftPropertyAsync()
on the returned BipartiteGraph
object.
The user has the option to specify a name for the newly created graph (newGraphName
) as well as a custom name for the Boolean left-vertex indicating property (isLeftPropName
). The user can also specify the vertex and edge properties to be copied into the newly created graph instance (vertexProps
and edgeProps
).
Parent topic: Graph Mutation and Subgraphs