def _find_chordality_breaker(G, s=None, treewidth_bound=sys.maxsize):
 unnumbered = set(G)
 if (s is None):
  s = random.choice(list(unnumbered))
 unnumbered.remove(s)
 numbered = set([s])
 current_treewidth = (-1)
 while unnumbered:
  v = _max_cardinality_node(G, unnumbered, numbered)
  unnumbered.remove(v)
  numbered.add(v)
  clique_wanna_be = (set(G[v]) & numbered)
  sg = G.subgraph(clique_wanna_be)
  if _is_complete_graph(sg):
   current_treewidth = max(current_treewidth, len(clique_wanna_be))
   if (current_treewidth > treewidth_bound):
    raise nx.NetworkXTreewidthBoundExceeded(('treewidth_bound exceeded: %s' % current_treewidth))
  else:
   (u, w) = _find_missing_edge(sg)
   return (u, v, w)
 return ()

def _find_chordality_breaker ( G , s = None , treewidth_bound = sys . maxsize ) : unnumbered = set ( G ) if ( s is None ) : s = random . choice ( list ( unnumbered ) ) unnumbered . remove ( s ) numbered = set ( [ s ] ) current_treewidth = ( - 1 ) while unnumbered : v = _max_cardinality_node ( G , unnumbered , numbered ) unnumbered . remove ( v ) numbered . add ( v ) clique_wanna_be = ( set ( G [ v ] ) & numbered ) sg = G . subgraph ( clique_wanna_be ) if _is_complete_graph ( sg ) : current_treewidth = max ( current_treewidth , len ( clique_wanna_be ) ) if ( current_treewidth > treewidth_bound ) : raise nx . NetworkXTreewidthBoundExceeded ( ( 'treewidth_bound exceeded: %s' % current_treewidth ) ) else : ( u , w ) = _find_missing_edge ( sg ) return ( u , v , w ) return ( )
given a graph g .