Created
December 28, 2019 07:43
-
-
Save prateekjoshi565/615b6d28f09c02e1fb8b7be8c8d23fae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get unconnected node-pairs | |
all_unconnected_pairs = [] | |
# traverse adjacency matrix | |
offset = 0 | |
for i in tqdm(range(adj_G.shape[0])): | |
for j in range(offset,adj_G.shape[1]): | |
if i != j: | |
if nx.shortest_path_length(G, str(i), str(j)) <=2: | |
if adj_G[i,j] == 0: | |
all_unconnected_pairs.append([node_list[i],node_list[j]]) | |
offset = offset + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment