(spanning_leaves, num_leaf_images)
return num_images
Create a dict mapping each node to the number of images in its sub-graph.

  This assumes that all images live in the leaves of the graph (as is the case
  in our graph by construction: we are only interested in using images from the
  ILSVRC 2012 synsets, and these synsets are all and only the leaves of the
  sampling graph).

  Args:
    spanning_leaves: a dict mapping each node to the set of leaves it spans.
    num_leaf_images: a dict mapping each leaf synset to its number of images.

  Returns:
    num_images: a dict that maps each node in the sampling graph to the number
      of images in the leaves that it spans.
Create a dict mapping each node to the number of images in its sub-graph.
Create a dict mapping each node to the number of images in its sub - graph .
def get_num_spanning_images(spanning_leaves, num_leaf_images):
  """Create a dict mapping each node to the number of images in its sub-graph.

  This assumes that all images live in the leaves of the graph (as is the case
  in our graph by construction: we are only interested in using images from the
  ILSVRC 2012 synsets, and these synsets are all and only the leaves of the
  sampling graph).

  Args:
    spanning_leaves: a dict mapping each node to the set of leaves it spans.
    num_leaf_images: a dict mapping each leaf synset to its number of images.

  Returns:
    num_images: a dict that maps each node in the sampling graph to the number
      of images in the leaves that it spans.
  """
  num_images = {}
  for node, leaves in spanning_leaves.items():
    num_images[node] = sum([num_leaf_images[l.wn_id] for l in leaves])
  return num_images
def get_num_spanning_images ( spanning_leaves , num_leaf_images ) : num_images = { } for node , leaves in spanning_leaves . items ( ) : num_images [ node ] = sum ( [ num_leaf_images [ l . wn_id ] for l in leaves ] ) return num_images