Skip to content

Commit

Permalink
Bugfix - Correct plot and is_connected
Browse files Browse the repository at this point in the history
Fix betweenness_distribution (and therefore docs)
Also correct is_connected with nngt backend.
  • Loading branch information
tfardet committed Aug 15, 2021
1 parent ccdd627 commit 84098f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ secrets:
- 0b249c79-8eaf-4b82-b1d1-f3c38c7eae4b
tasks:
- check: |
mv .coveralls.yml NNGT/.coveralls.yml 2>/dev/null
mv .coveralls.yml NNGT/.coveralls.yml || true
cd NNGT
python3 extra/check_headers.py
- setup: |
Expand Down
8 changes: 4 additions & 4 deletions nngt/core/nngt_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,19 +491,19 @@ def is_connected(self, mode="strong"):
Whether to test connectedness with directed ("strong") or
undirected ("weak") connections.
'''
num_nodes = g.node_nb()
num_nodes = self.node_nb()

# get adjacency matrix
A = g.adjacency_matrix()
A = self.adjacency_matrix()

if mode == "weak" and g.is_directed():
if mode == "weak" and self.is_directed():
A = A + A.T

visited = _dfs(A, 0)

if len(visited) != num_nodes:
return False
elif mode == "strong" and g.is_directed():
elif mode == "strong" and self.is_directed():
visited = _dfs(A.T, 0)

if len(visited) != num_nodes:
Expand Down
2 changes: 1 addition & 1 deletion nngt/plot/plt_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def betweenness_distribution(
axes = [ax1.twinx()]

if num_axes == 2:
ax2 = ax.twiny()
ax2 = ax1.twiny()
axes.append(ax2)
ax1.grid(False, axis='x')
ax1.yaxis.tick_right()
Expand Down

0 comments on commit 84098f5

Please sign in to comment.