Skip to content

Instantly share code, notes, and snippets.

@mazieres
Created October 28, 2015 07:31
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 mazieres/936c817fc24142c9c696 to your computer and use it in GitHub Desktop.
Save mazieres/936c817fc24142c9c696 to your computer and use it in GitHub Desktop.
min_freq = 1
min_weight = 3
min_degree = 2
G.remove_edges_from([(u, v, d) for u, v, d in G.edges(data=True)
if d['weight'] <= min_weight])
G.remove_nodes_from([n for n, d in G.nodes(data=True)
if d['freq'] <= min_freq or
len(G[n]) <= min_degree])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment