(nodes)
Remove links between Synsets in nodes and Synsets that are not in nodes.

  This effectively isolates the graph defined by nodes from the rest of the
  Synsets. The resulting set of nodes is such that following any of their child/
  parent pointers can only lead to other Synsets of the same set of nodes.
  This requires breaking the necessary parent / child links.

  Args:
    nodes: A set of Synsets
Remove links between Synsets in nodes and Synsets that are not in nodes.
Remove links between Synsets in nodes and Synsets that are not in nodes .
def isolate_graph(nodes):
  """Remove links between Synsets in nodes and Synsets that are not in nodes.

  This effectively isolates the graph defined by nodes from the rest of the
  Synsets. The resulting set of nodes is such that following any of their child/
  parent pointers can only lead to other Synsets of the same set of nodes.
  This requires breaking the necessary parent / child links.

  Args:
    nodes: A set of Synsets
  """
  for n in nodes:
    n.children = list(nodes & set(n.children))
    n.parents = list(nodes & set(n.parents))
def isolate_graph ( nodes ) : for n in nodes : n . children = list ( nodes & set ( n . children ) ) n . parents = list ( nodes & set ( n . parents ) )