You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We may want to do this by allowing extract_subgraph to take a PropertyGraph for the create_using arg.
Here's a workaround I posted:
>>>fromcugraphimportGraph>>>fromcugraph.experimentalimportPropertyGraph>>>importcudf>>>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, vertex_col_names=("src", "dst"))
>>>pG.get_edge_data()
_EDGE_ID_some_property_SRC__DST__TYPE_00a992211b983422c975633d9688>>># Select edges 'a' and 'b'>>>selection=pG.select_edges("(some_property=='a')|(some_property=='b')")
>>># Extract a subgraph as a cugraph directed Graph, include the edge property>>># meta-data for use in future calls to annotate_dataframe()>>>G2=pG.extract_subgraph(selection=selection,
... create_using=Graph(directed=True),
... add_edge_data=True)
>>># Create a DataFrame containing the property data for the extracted edges>>># referencing the original PropertyGraph from which it was extracted>>>subgraph_edge_data=pG.annotate_dataframe(G2.edges(), G2, edge_vertex_col_names=["src", "dst"])
>>># Create a new PropertyGraph using the extracted data>>>subPG=PropertyGraph()
>>>subPG.add_edge_data(subgraph_edge_data,
... vertex_col_names=["src", "dst"],
... property_columns=["some_property"])
>>>subPG.get_edge_data()
_EDGE_ID_some_property_TYPE__SRC__DST_00b983411a9922
Is this a new feature, an improvement, or a change to existing functionality?
New Feature
How would you describe the priority of this feature request
High
Please provide a clear description of problem this feature solves
a way to extract a subgraph or sample of a PropertyGraph object without converting it to a cugraph object.
Describe your ideal solution
the PropertySelection objects returned from e.g. select_vertices can be used to extract a new PropertyGraph
Describe any alternatives you have considered
No response
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: