def find_dependent_tables(tables, graph=None):
 if (graph is None):
  graph = _pokedex_graph
 tables = list(tables)
 dependents = set()
 def add_dependents_of(table):
  for dependent_table in graph.get(table, []):
   if (dependent_table not in dependents):
    dependents.add(dependent_table)
    add_dependents_of(dependent_table)
 for table in tables:
  add_dependents_of(table)
 dependents -= set(tables)
 return dependents

def find_dependent_tables ( tables , graph = None ) : if ( graph is None ) : graph = _pokedex_graph tables = list ( tables ) dependents = set ( ) def add_dependents_of ( table ) : for dependent_table in graph . get ( table , [ ] ) : if ( dependent_table not in dependents ) : dependents . add ( dependent_table ) add_dependents_of ( dependent_table ) for table in tables : add_dependents_of ( table ) dependents -= set ( tables ) return dependents
recursively find all tables which depend on the given tables .