Skip to content

Commit

Permalink
Merge pull request rapidsai#1279 from Iroy30/self_loop_check
Browse files Browse the repository at this point in the history
[REVIEW] add self loop check variable
  • Loading branch information
BradReesWork authored Nov 30, 2020
2 parents 1df2a42 + dc6b6fc commit b98175e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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
Expand Down
3 changes: 3 additions & 0 deletions python/cugraph/structure/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit b98175e

Please sign in to comment.