class_docstr: A graph data structure to simplify the edge cost graph. It has two main functions:
  1. To feed the quadratic resharding costs into solver, we need to linearize it. We build edge_cost in
  CostGraph, and it stored every combinations of strategies for a src-dst node pair in an 1D list.
  2. To reduce the searching space, we merge computationally-trivial operators, such as
  element-wise operators, transpose, and reduction, into their following nodes. The merging information will
  be given by the StrategiesVector depending on the type of target node and following nodes.
  
  Argument:
      leaf_strategies(List[StrategiesVector]): It stores StrategiesVector of every nodes on the graph.
      simplify(bool, optional): The generated cost graph will be simplified if it is true. (default to True)
code: def simplify_graph(self):
      if not self.simplify:
          return
      self.merge_pair.reverse()
      for src_node, dst_node in self.merge_pair:
          self.merge_node(src_node, dst_node)
      self.merge_pair.reverse()
      reindexing_following_dict = {}
      for dst, src in self.following_dict.items():
          reindexing_following_dict[dst] = self._reindexing_src(src)
      self.following_dict = reindexing_following_dict
  
file_path: ColossalAI/colossalai/auto_parallel/tensor_shard/solver/cost_graph.py
imports: import torch
  from colossalai.auto_parallel.tensor_shard.constants import INFINITY_COST
label_desc: Use image node_id 7 for calling the CostGraph obj's underlying member method code with example usage: obj.simplify_graph() without return types