Package org.plumelib.util
Class GraphPlume
java.lang.Object
org.plumelib.util.GraphPlume
Graph utility methods. This class does not model a graph: all methods are static.
-
Method Summary
Modifier and TypeMethodDescriptiondominators
(Map<T, List<@KeyFor("#1") T>> predecessors) Computes, for each node in the graph, its set of (pre-)dominators.static <T extends @NonNull Object>
voidprint
(Map<T, List<T>> graph, PrintStream ps, int indent) Print a representation of the graph to ps, indented by intent spaces.
-
Method Details
-
dominators
public static <T extends @NonNull Object> Map<T,List<T>> dominators(Map<T, List<@KeyFor("#1") T>> predecessors) Computes, for each node in the graph, its set of (pre-)dominators. Supply a successor graph if you want post-dominators.- Type Parameters:
T
- type of the graph nodes- Parameters:
predecessors
- a graph, represented as a predecessor map- Returns:
- a map from each node to a list of its pre-dominators
-
print
public static <T extends @NonNull Object> void print(Map<T, List<T>> graph, PrintStream ps, int indent) Print a representation of the graph to ps, indented by intent spaces.- Type Parameters:
T
- the type of nodes of the graph- Parameters:
graph
- the graph to printps
- the PrintStream to which to print the graphindent
- the number of spaces by which to indent the printed representation
-