Skip to content

Commit

Permalink
[DGLHeteroGraph] Add unittest for srcdst Order for DGLHeteroGraph.all…
Browse files Browse the repository at this point in the history
…_edges (dmlc#1677)

* Fix (dmlc#1)

* Update

* Fix

* Fix

* Update

* Fix

* Fix

* Fix

* Fix

* Fixg

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add test case

* Trigger CI (dmlc#2)

* Update

* Fix

* Fix

* Update

* Fix

* Fix

* Fix

* Fix

* Fixg

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add test case

* test

* Fix (dmlc#3)

* Update

* Fix

* Fix

* Update

* Fix

* Fix

* Fix

* Fix

* Fixg

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add test case

* test

* Fix

* Fix

* Roll back

* Roll back

* CI

Co-authored-by: Minjie Wang <wmjlyjemaine@gmail.com>
  • Loading branch information
2 people authored and kingmbc committed Aug 2, 2020
1 parent c29009a commit 631df8b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/compute/test_heterograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,19 @@ def test_format():
assert g.restrict_format(rel_type) == 'csr'
assert g.format_in_use(rel_type) == ['csr']

def test_edges_order():
# (0, 2), (1, 2), (0, 1), (0, 1), (2, 1)
g = dgl.graph((
np.array([0, 1, 0, 0, 2]),
np.array([2, 2, 1, 1, 1])
))

src, dst = g.all_edges(order='srcdst')
assert F.array_equal(F.copy_to(src, F.cpu()),
F.copy_to(F.tensor([0, 0, 0, 1, 2]), F.cpu()))
assert F.array_equal(F.copy_to(dst, F.cpu()),
F.copy_to(F.tensor([1, 1, 2, 2, 1]), F.cpu()))

if __name__ == '__main__':
# test_create()
# test_query()
Expand Down

0 comments on commit 631df8b

Please sign in to comment.