Unverified Commit d03138e2 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by GitHub
Browse files

[Bugfix?] Remove simple graph requirement for to_bidirected (#3630)



* remove simple graph requirement

* doc
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
parent 7f83d745
......@@ -634,8 +634,8 @@ def to_bidirected(g, copy_ndata=False, readonly=None):
r"""Convert the graph to a bi-directional simple graph and return.
For an input graph :math:`G`, return a new graph :math:`G'` such that an edge
:math:`(u, v)\in G'` if and only if there exists an edge :math:`(u, v)\in G` or
an edge :math:`(v, u)\in G`. The resulting graph :math:`G'` is a simple graph,
:math:`(u, v)\in G'` exists if and only if there exists an edge
:math:`(v, u)\in G`. The resulting graph :math:`G'` is a simple graph,
meaning there is no parallel edge.
The operation only works for edges whose two endpoints belong to the same node type.
......@@ -709,8 +709,6 @@ def to_bidirected(g, copy_ndata=False, readonly=None):
"unidirectional bipartite graphs" \
", but {} is unidirectional bipartite".format(c_etype)
assert g.is_multigraph is False, "to_bidirected only support simple graph"
g = add_reverse_edges(g, copy_ndata=copy_ndata, copy_edata=False)
g = to_simple(g, return_counts=None, copy_ndata=copy_ndata, copy_edata=False)
return g
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment