private boolean isAnyParentNodeSelected(final Node n) {
    final Graph2D graph = (Graph2D) n.getGraph();
    final HierarchyManager hierarchy = graph.getHierarchyManager();

    if (hierarchy == null) {
      return false;
    }

    boolean result = false;
    Node parent = hierarchy.getParentNode(n);
    while (parent != null) {
      if (graph.isSelected(parent)) {
        result = true;
        break;
      }
      parent = hierarchy.getParentNode(parent);
    }
    return result;
  }
Determines whether any of the parent nodes of the given node is selected.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/ZyGraphLayeredRenderer.java