def computeExtendedDependencies(dependencies):
  """
  Computes the extended dependencies for the given dependencies.
  The extended dependencies are defined as follows:
  In the following let E denote the set of existential variables 
  (i.e. the keys of <dependencies>)
  ext_dep(e):=dep(e) union {v in E | dep(v) < dep(e) or (dep(e) == dep(v) and v < e)}
  
  Parameters
  ----------
  dependencies : dictionary
      The dependencies to consider
  
  Returns
  -------
  A dictionary representing the extended dependencies

  """
  dependency_sets = {v:set(dep) for v,dep in dependencies.items()}
  extended_dependencies = {}
  for v1, dep1 in dependencies.items():
    extended_dependencies[v1]=dep1
    dependency_set=dependency_sets[v1]
    for v2 in extended_dependencies.keys():
      if v1 == v2:
        continue
      dep2=dependency_sets[v2]
      if dependency_set <= dep2:
        if len(dependency_set) == len(dep2):
          if v1 < v2:
            extended_dependencies[v2] = extended_dependencies[v2] + [v1]
          else:
            extended_dependencies[v1] = extended_dependencies[v1] + [v2]
        else:
          extended_dependencies[v2] = extended_dependencies[v2] + [v1]
      elif dep2 < dependency_set:
        extended_dependencies[v1] = extended_dependencies[v1] + [v2]
  return extended_dependencies