cugraph.Graph.add_internal_vertex_id#

Graph.add_internal_vertex_id(df, internal_column_name, external_column_name, drop=True, preserve_order=False)[source]#

Given a DataFrame containing external vertex ids in the identified columns, return a DataFrame containing the internal vertex ids as the specified column name. Optionally drop the external vertex id columns. Optionally preserve the order of the original DataFrame.

Parameters:
df: cudf.DataFrame or dask_cudf.DataFrame

A DataFrame containing external vertex identifiers that will be converted into internal vertex identifiers.

internal_column_name: string

Name of column to contain the internal vertex id

external_column_name: string or list of strings

Name of the column(s) containing the external vertex ids

drop: bool, optional (default=True)

Drop the external columns from the returned DataFrame

preserve_order: bool, optional (default=False)

Preserve the order of the data frame (requires an extra sort)

Returns:
dfcudf.DataFrame or dask_cudf.DataFrame

Original DataFrame with new column containing internal vertex id