cugraph.experimental.PropertyGraph.renumber_edges_by_type#

PropertyGraph.renumber_edges_by_type(prev_id_column=None)[source]#

Renumber edge IDs to be contiguous by type.

Parameters:
prev_id_columnstr, optional

Column name to save the edge ID before renumbering.

Returns:
DataFrame

with the start and stop IDs for each edge type. Stop is inclusive.

Examples

>>> import cugraph
>>> import cudf
>>> from cugraph.experimental import PropertyGraph
>>> pG = PropertyGraph()
>>> df = cudf.DataFrame(columns=["src", "dst", "edge_ids" ,"some_property"],
...                     data=[(99, 22, 3, "a"),
...                           (98, 34, 5, "b"),
...                           (97, 56, 7, "c"),
...                           (96, 88, 11, "d"),
...                          ])
>>> df2 = cudf.DataFrame(columns=["src", "dst", "edge_ids" ,"some_property"],
...                      data=[(95, 24, 2, "a"),
...                            (94, 36, 4, "b"),
...                            (93, 88, 8, "d"),
...                           ])
>>> pG.add_edge_data(df,
...                  type_name="etype1",
...                  vertex_col_names=("src", "dst"),
...                  edge_id_col_name="edge_ids")
>>> pG.add_edge_data(df2,
...                  type_name="etype2",
...                  vertex_col_names=("src", "dst"),
...                  edge_id_col_name="edge_ids")
>>> pG.renumber_edges_by_type()
        start  stop
etype1      0     3
etype2      4     6