Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Last active December 28, 2019 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/243fae553d34f6ded98c69e8fddfc1a1 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/243fae553d34f6ded98c69e8fddfc1a1 to your computer and use it in GitHub Desktop.
# combine all nodes in a list
node_list = node_list_1 + node_list_2
# remove duplicate items from the list
node_list = list(dict.fromkeys(node_list))
# build adjacency matrix
adj_G = nx.to_numpy_matrix(G, nodelist = node_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment