Overview
This section describes two methods of modifying a graph using passes. The following table describes the differences between the two methods.
Graph Modification Method |
Pass Based on Pattern Mapping (Recommended) |
Pass Based on the Graph Modification API |
|---|---|---|
Core approach |
Define a matching template using a pattern. The framework automatically performs matching and search. You only need to define the replacement structure. |
Directly write the graph modification function, manually traverse the graph structure, search for nodes, create new nodes, establish edge connections, and delete old nodes. |
Key features |
Only three steps are required: matching → decision-making → replacement.
|
|
Application scenario |
When no constraint is triggered |
|
Constraints/Prohibited items |
|
- |
Parent topic: Modifying a Graph Using a Custom Pass