diff --git a/CHANGELOG.md b/CHANGELOG.md index d756b7dcec8..2b2fa79705e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - PR #1264 CuPy sparse matrix input support for WCC, SCC, SSSP, and BFS - PR #1265 Implement Hungarian Algorithm - PR #1274 Add generic from_edgelist() and from_adjlist() APIs +- PR #1279 Add self loop check variable in graph ## Improvements - PR #1227 Pin cmake policies to cmake 3.17 version diff --git a/python/cugraph/structure/graph.py b/python/cugraph/structure/graph.py index fdeaff536ac..375e095a0ec 100644 --- a/python/cugraph/structure/graph.py +++ b/python/cugraph/structure/graph.py @@ -99,6 +99,7 @@ def __init__( self.multi = multi self.distributed = False self.dynamic = dynamic + self.self_loop = False self.edgelist = None self.adjlist = None self.transposedadjlist = None @@ -403,6 +404,8 @@ def from_cudf_edgelist( if type(source) is list and type(destination) is list: raise Exception("set renumber to True for multi column ids") + if (elist[source] == elist[destination]).any(): + self.self_loop = True source_col = elist[source] dest_col = elist[destination]