Created
December 28, 2019 08:18
-
-
Save prateekjoshi565/1e6b27b66086bfbc7f4dc4093c0f0c3e 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
initial_node_count = len(G.nodes) | |
fb_df_temp = fb_df.copy() | |
# empty list to store removable links | |
omissible_links_index = [] | |
for i in tqdm(fb_df.index.values): | |
# remove a node pair and build a new graph | |
G_temp = nx.from_pandas_edgelist(fb_df_temp.drop(index = i), "node_1", "node_2", create_using=nx.Graph()) | |
# check there is no spliting of graph and number of nodes is same | |
if (nx.number_connected_components(G_temp) == 1) and (len(G_temp.nodes) == initial_node_count): | |
omissible_links_index.append(i) | |
fb_df_temp = fb_df_temp.drop(index = i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment