private synchronized void removeZeroInDegreeNode(String role) {
    RoleGraphNode nodeToRemove = graph.remove(role);
    for (RoleGraphNode edgeNode : nodeToRemove.getEdges()) {
      edgeNode.decrementInDegree();
    }
  }
Assumes there are no incoming edges.
ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java