cugraph.from_cudf_edgelist#

cugraph.from_cudf_edgelist(df, source='source', destination='destination', edge_attr=None, create_using=<class 'cugraph.structure.graph_classes.Graph'>, renumber=True)[source]#

Return a new graph created from the edge list representaion. This function is added for NetworkX compatibility (this function is a RAPIDS version of NetworkX’s from_pandas_edge_list()). This function does not support multiple source or destination columns. But does support renumbering

Parameters:
dfcudf.DataFrame

This cudf.DataFrame contains columns storing edge source vertices, destination (or target following NetworkX’s terminology) vertices, and (optional) weights.

sourcestring or integer, optional (default=’source’)

This is used to index the source column.

destinationstring or integer, optional (default=’destination’)

This is used to index the destination (or target following NetworkX’s terminology) column.

edge_attrstring or integer, optional (default=None)

This pointer can be None. If not, this is used to index the weight column.

create_using: cugraph.Graph (instance or class), optional (default=Graph)

Specify the type of Graph to create. Can pass in an instance to create a Graph instance with specified ‘directed’ attribute.

renumberbool, optional (default=True)

If source and destination indices are not in range 0 to V where V is number of vertices, renumber argument should be True.

Examples

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