Storyboard TTC2011DeleteNodeWithSpecificName


Delete node with name n1 and its incidemnt edges.

Start graph:

Transformation:

   private NodePO deleteNodeWithNameN1(Graph graph)
   {
      // find node
      NodePO nodeN1PO = new GraphPO(graph)
      .hasNodes()
      .hasName("n1");

      // destroy all leaving edges
      nodeN1PO.startSubPattern()
      .hasOutEdges()
      .destroy()
      .endSubPattern()
      .allMatches();

      // destroy all incoming edges
      nodeN1PO.startSubPattern()
      .hasInEdges()
      .destroy()
      .endSubPattern()
      .allMatches();

      // destroy the node
      nodeN1PO.destroy().allMatches();

      return nodeN1PO;
   }

Result graph: