private static <NodeType extends IGraphNode<NodeType>> void getPredecessors(
      final IGraphNode<NodeType> node,
      final Set<NodeType> predecessors,
      final Set<NodeType> visited) {
    for (final NodeType parent : node.getParents()) {
      // Make sure that each node is only visited once.
      if (visited.contains(parent)) {
        continue;
      }

      visited.add(parent);

      predecessors.add(parent);

      // Recursively find the predecessors of all parent nodes.
      getPredecessors(parent, predecessors, visited);
    }
  }
Helper function that supports the public getPredecessors function.

@param <NodeType> The type of the nodes in the graph.
@param node The node which is the starting point for finding the predecessors.
@param predecessors List of predecessors of the start node.
@param visited List of nodes in the graph that were already visited.
java/zylib/src/main/java/com/google/security/zynamics/zylib/types/graphs/GraphAlgorithms.java