cugraph.experimental.PropertyGraph.get_num_edges#

PropertyGraph.get_num_edges(type=None)[source]#

Return the number of all edges or edges of a given type.

Parameters:
typestring, optional

Edge type or None, if None then all edges are counted

Returns:
int

If type is None (the default), returns the total number of edges, otherwise return the number of edges of the specified type.

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, type_name="etype", vertex_col_names=("src", "dst"))
>>> pG.get_num_edges()
4