def k_crust(G, k=None, core_number=None):
 if (core_number is None):
  core_number = find_cores(G)
 if (k is None):
  k = (max(core_number.values()) - 1)
 nodes = (v for v in core_number if (core_number[v] <= k))
 return G.subgraph(nodes).copy()

def k_crust ( G , k = None , core_number = None ) : if ( core_number is None ) : core_number = find_cores ( G ) if ( k is None ) : k = ( max ( core_number . values ( ) ) - 1 ) nodes = ( v for v in core_number if ( core_number [ v ] <= k ) ) return G . subgraph ( nodes ) . copy ( )
return the k-crust of g .