cugraph.experimental.PropertyGraph.get_num_vertices#
- PropertyGraph.get_num_vertices(type=None, *, include_edge_data=True)[source]#
Return the number of all vertices or vertices of a given type.
- Parameters:
- typestring, optional
If type is None (the default), return the total number of vertices, otherwise return the number of vertices of the specified type.
- include_edge_databool (default True)
If True, include vertices that were added in vertex and edge data. If False, only include vertices that were added in vertex data. Note that vertices that only exist in edge data are assumed to have the default type.
- Returns:
- int
The number of vertices in the graph constrained by the type parameter.
See also
Examples
>>> import cugraph >>> import cudf >>> from cugraph.experimental import PropertyGraph >>> df = cudf.DataFrame(columns=["src", "dst", "some_property"], ... data=[(99, 22, "a"), ... (98, 34, "b"), ... (97, 56, "c"), ... (96, 88, "d"), ... ]) >>> pG = PropertyGraph() >>> pG.add_edge_data(df, vertex_col_names=("src", "dst")) >>> pG.get_num_vertices() 8