Skip to content

Commit

Permalink
nngraph: fix attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Feb 24, 2019
1 parent 9c8e86e commit bfef548
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pygsp/graphs/nngraphs/nngraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def __init__(self, features, standardize=False,
radius = graph.kernel_width
elif radius <= 0:
raise ValueError('The radius must be greater than 0.')
k = None
self.k = None
else:
raise ValueError('Invalid kind "{}".'.format(kind))

Expand Down
4 changes: 4 additions & 0 deletions pygsp/tests/test_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ def test_nngraph(self, n_vertices=24):
Graph(data, kernel=lambda d: d.min()/d)
self.assertRaises(ValueError, Graph, data, kernel=lambda d: 1/d)

# Attributes.
self.assertEqual(Graph(data, kind='knn').radius, None)
self.assertEqual(Graph(data, kind='radius').k, None)

def test_bunny(self):
graphs.Bunny()

Expand Down

0 comments on commit bfef548

Please sign in to comment.