The wcc.py query module can run WCC analysis on a sub-graph of the whole graph.
This procedure finds weakly connected components of a given subgraph of a directed graph.
The subgraph is defined by a list of vertices and a list of edges which are passed as arguments of the procedure.
- vertices (mgp.List[mgp.Vertex]) – A set of vertices of a subgraph containing all vertices provided in a list of vertices along with all vertices that are endpoints of provided edges.
- edges (mgp.List[mgp.Edge]) – A set of edges of a subgraph contains all edges from the list of provided edges.
The procedure returns 2 fields. The first,
n_components, is the number
of weakly connected components of the subgraph. The second,
is a list of weakly connected components. Each component is given as a
mgp.Vertex objects from that component.
For example, weakly connected components in a subgraph formed from all vertices labeled
Person and edges between such vertices can be obtained using the following openCypher query: