Skip to content

Commit

Permalink
update error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 committed Sep 28, 2024
1 parent 3b1c1d0 commit 0462529
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,29 @@ def __from_edgelist(
"The edgelist can only be symmetrized for undirected graphs."
)

if symmetrize or symmetrize is None:
unsupported = False
if edge_id is not None or edge_type is not None:
unsupported = True
if isinstance(edge_attr, list):
if len(edge_attr) > 1:
unsupported = True
if unsupported:
if self.properties.directed:
if symmetrize:
raise ValueError(
"Edge list containing Edge Ids or Types can't be symmetrized. "
"If the edges are already symmetric, set the 'symmetrize' "
"flag to False"
"The edgelist can only be symmetrized for undirected graphs."
)
if symmetrize is None:
# default behavior
symmetrize = not self.properties.directed
else:
if symmetrize or symmetrize is None:
unsupported = False
if edge_id is not None or edge_type is not None:
unsupported = True
if isinstance(edge_attr, list):
if len(edge_attr) > 1:
unsupported = True
if unsupported:
raise ValueError(
"Edge list containing Edge Ids or Types can't be symmetrized. "
"If the edges are already symmetric, set the 'symmetrize' "
"flag to False"
)

if symmetrize is None:
# default behavior
symmetrize = not self.properties.directed

s_col = source
d_col = destination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,30 @@ def __from_edgelist(
raise ValueError(
"The edgelist can only be symmetrized for undirected graphs."
)

if symmetrize or symmetrize is None:
unsupported = False
if edge_id is not None or edge_type is not None:
unsupported = True
if isinstance(edge_attr, list):
if len(edge_attr) > 1:
unsupported = True
if unsupported:

if self.properties.directed:
if symmetrize:
raise ValueError(
"Edge list containing Edge Ids or Types can't be symmetrized. "
"If the edges are already symmetric, set the 'symmetrize' "
"flag to False"
"The edgelist can only be symmetrized for undirected graphs."
)
if symmetrize is None:
# default behavior
symmetrize = not self.properties.directed
else:
if symmetrize or symmetrize is None:
unsupported = False
if edge_id is not None or edge_type is not None:
unsupported = True
if isinstance(edge_attr, list):
if len(edge_attr) > 1:
unsupported = True
if unsupported:
raise ValueError(
"Edge list containing Edge Ids or Types can't be symmetrized. "
"If the edges are already symmetric, set the 'symmetrize' "
"flag to False"
)

if symmetrize is None:
# default behavior
symmetrize = not self.properties.directed

# Verify column names present in input DataFrame
s_col = source
Expand Down

0 comments on commit 0462529

Please sign in to comment.