cugraph.structure.NumberMap.add_internal_vertex_id#

NumberMap.add_internal_vertex_id(df, id_column_name='id', col_names=None, drop=False, preserve_order=False)[source]#

Given a collection of external vertex ids, return the internal vertex ids combined with the input data. If a series-type input is provided then the series will be in a column named ‘0’. Otherwise the input column names in the DataFrame will be preserved.

Parameters:
df: cudf.DataFrame, cudf.Series, dask_cudf.DataFrame, dask_cudf.Series

Contains a list of external vertex identifiers that will be converted into internal vertex identifiers

id_column_name: string, optional (default=”id”)

The name to be applied to the column containing the id

col_names: list of strings, optional (default=None)

This list of 1 or more strings contain the names of the columns that uniquely identify an external vertex identifier

drop: boolean, optional (default=False)

If True, drop the column names specified in col_names from the returned DataFrame.

preserve_order: boolean, optional (default=False)

If True, do extra sorting work to preserve the order of the input DataFrame.

Returns:
dfcudf.DataFrame or dask_cudf.DataFrame

A DataFrame containing the input data (DataFrame or series) with an additional column containing the internal vertex id. Note that there is no guarantee of the order or partitioning of elements in the returned DataFrame.