-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update graph_classes.py #1914
Update graph_classes.py #1914
Conversation
Clarify exception message on Graph constructor. Colleague lost some time tracing this!
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
Thank you for submitting this and we're very sorry for the lost time. |
Thank you for the quick merge! We're migrating some graph processing codebases to cuGraph and enjoying so far. I'll do a sweep through exception messages and propose any other related clarifications in a separate PR. |
@@ -70,7 +70,7 @@ def __init__(self, m_graph=None, directed=False): | |||
edge_attr=weights) | |||
else: | |||
msg = ( | |||
"Graph can only be initialized using MultiGraph " | |||
"Graph can only be initialized using cuGraph or networkX MultiGraph object." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NetworkX MultiGraph graphs are not yet supported.
>>> import pandas as pd
>>> import networkx as nx
>>>
>>> import cudf
>>> import cugraph
>>>
>>> df = pd.DataFrame({"src":[0,1,2],"dst":[1,2,0]})
>>>
>>> nxMG = nx.from_pandas_edgelist(df, create_using=nx.MultiGraph,
... source="src", target="dst")
>>>
>>> cgMG = cugraph.MultiGraph()
>>> cgMG.from_pandas_edgelist(df, source="src", destination="dst")
>>>
>>> G = cugraph.Graph(m_graph=nxMG)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cugraph-21.12.0a0+57.gcb65876a-py3.8-linux-x86_64.egg/cugraph/structure/graph_classes.py", line 62, in __init__
elist = m_graph.view_edge_list()
AttributeError: 'MultiGraph' object has no attribute 'view_edge_list'
>>>
>>> G = cugraph.Graph(m_graph=cgMG)
>>>
"Graph can only be initialized using cuGraph or networkX MultiGraph object." | |
"Graph can only be initialized using a cugraph.MultiGraph object." |
ok to test |
@bmg-pcl - it looks like your change failed our automated style check:
so you may have to split the message across two lines. |
…invalid MultiGraph is passed in (#1925) * Updated error message and using a proper TypeError exception when an invalid MultiGraph is passed in. * Added test to verify. This PR replaces #1914 since that one is not passing the style check and the author has not responded. Authors: - Rick Ratzel (https://github.com/rlratzel) Approvers: - Brad Rees (https://github.com/BradReesWork) URL: #1925
Clarify exception message on Graph constructor.
Colleague lost some time tracing this!