docs: def _create_graph(self, upgrades, history=None):
          """Create dependency graph from upgrades.
  
          :param upgrades: Dict of upgrades
          :param history: Dict of applied upgrades
          """
          history = history or {}
          graph_incoming = {}  # nodes their incoming edges
          graph_outgoing = {}  # nodes their outgoing edges
  
          # Create graph data structure
          for mod in six.itervalues(upgrades):
              # Remove all incoming edges from already applied upgrades
              graph_incoming[mod.name] = [x for x in mod.depends_on
                                          if x not in history]
              # Build graph_outgoing
              if mod.name not in graph_outgoing:
                  graph_outgoing[mod.name] = []
              for edge in graph_incoming[mod.name]:
                  if edge not in graph_outgoing:
                      graph_outgoing[edge] = []
                  graph_outgoing[edge].append(mod.name)
  
          return (graph_incoming, graph_outgoing)