Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.