private void identifyTransitiveDependencies(RoleCommandPair rcp, HashSet<RoleCommandPair> visited,
                                                     HashSet<RoleCommandPair> transitiveDependencies) {
    if (dependencies.get(rcp) != null) {
      for (RoleCommandPair blockedOn : dependencies.get(rcp)) {
        if (!visited.contains(blockedOn)) {
          visited.add(blockedOn);
          transitiveDependencies.add(blockedOn);
          identifyTransitiveDependencies(blockedOn, visited, transitiveDependencies);
        }
      }
    }
  }
Adds transitive dependencies to each node.
A => B and B => C implies A => B,C and B => C
ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java