text: Title: A more universal function to replace subgraph in OptimizationRule
  Body: <!--
  Thank you for your contribution!
  
  Please review https://github.com/mars-project/mars/blob/master/CONTRIBUTING.rst before opening an issue.
  -->
  Currently in OptimizationRule, there're only collapsable_predecessors adding/removing and node replacing functions to handle graph mutation. However, some new rules may need to replace a piece of subgraph by adding/removing nodes and edges. Thus we need a more universal function to do this work.
  