cugraph.triangle_count#

cugraph.triangle_count(G, start_list=None)[source]#

Compute the number of triangles (cycles of length three) in the input graph.

Parameters:
Gcugraph.graph or networkx.Graph

cuGraph graph descriptor, should contain the connectivity information, (edge weights are not used in this algorithm). The current implementation only supports undirected graphs.

start_listlist or cudf.Series

list of vertices for triangle count. if None the entire set of vertices in the graph is processed

Returns:
resultcudf.DataFrame

GPU data frame containing 2 cudf.Series

ddf[‘vertex’]: cudf.Series

Contains the triangle counting vertices

ddf[‘counts’]: cudf.Series

Contains the triangle counting counts

Examples

>>> gdf = cudf.read_csv(datasets_path / 'karate.csv',
...                     delimiter = ' ',
...                     dtype=['int32', 'int32', 'float32'],
...                     header=None)
>>> G = cugraph.Graph()
>>> G.from_cudf_edgelist(gdf, source='0', destination='1', edge_attr='2')
>>> count = cugraph.triangle_count(G)