cugraph.experimental.PropertyGraph.edge_props_to_graph#

PropertyGraph.edge_props_to_graph(edge_prop_df, create_using, edge_weight_property=None, default_edge_weight=None, check_multi_edges=True, renumber_graph=True, add_edge_data=True)[source]#

Create a Graph from the edges in edge_prop_df.

Parameters:
edge_prop_dfcudf.DataFrame or pandas.DataFrame

conains the edge data with properties

create_usingcugraph.Graph (or subclass of) instance.

Attributes of the graph are passed to the returned graph.

edge_weight_propertystring, optional

Property used to weight the returned graph.

default_edge_weightfloat64, optional

Value used to replace NA in the specified weight column

check_multi_edgesbool, optional (default=True)

Prevent duplicate edges (if not allowed)

renumber_graphbool, optional (default=True)

If True renumber edge Ids to start at 0, otherwise maintain the original ids

add_edge_data bool, optional(default=True)
Returns:
A CuGraph or NetworkX Graph

contains the edges in edge_prop_df

Examples

>>> import cugraph
>>> import cudf
>>> from cugraph.experimental import PropertyGraph
>>> df = cudf.DataFrame(columns=["src", "dst", "some_property"],
...                     data=[(99, 22, "a"),
...                           (98, 34, "b"),
...                           (97, 56, "c"),
...                           (96, 88, "d"),
...                          ])
>>> pG = PropertyGraph()
>>> pG.add_edge_data(df, type_name="etype", vertex_col_names=("src", "dst"))
>>> G = pG.edge_props_to_graph(pG.edges,
...                        create_using=cugraph.Graph(),
...                        renumber_graph=False)
>>> G.edges()
src  dst
0   88   96
1   22   99
2   56   97
3   34   98