Package ghidra.graph.algo
Class ChkDominanceAlgorithm<V,E extends GEdge<V>>
java.lang.Object
ghidra.graph.algo.ChkDominanceAlgorithm<V,E>
- Type Parameters:
V
- the vertex typeE
- the edge type
- Direct Known Subclasses:
ChkPostDominanceAlgorithm
This algorithm is an implementation of the Cooper, Harvey, Kennedy algorithm.
The algorithm processes the graph in reverse post-order. The runtime of
this algorithm is approximately O(V+E*D)
per iteration of the loop, where
D is the size of the largest dominator set. The number of iterations is
bound at d(G) + 3
, where d(G) is the "loop
connectedness" of the graph.
-
Constructor Summary
ConstructorDescriptionChkDominanceAlgorithm
(GDirectedGraph<V, E> g, TaskMonitor monitor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Releases cached values used by internal data structuresReturns the dominance tree for the given graph, which is tree where each node's children are those nodes it *immediately* dominates (a idom b).getDominated
(V a) Returns all nodes dominated by the given vertex.getDominators
(V a) Returns all nodes that dominate the given vertex.protected static <V,
E extends GEdge<V>>
VunifySinks
(MutableGDirectedGraphWrapper<V, E> graph, GraphNavigator<V, E> graphNavigator) Converts multiple sink/exit nodes in a graph into a single sink of which those become parents.protected static <V,
E extends GEdge<V>>
VunifySources
(MutableGDirectedGraphWrapper<V, E> graph, GraphNavigator<V, E> graphNavigator) Converts multiple source/root nodes in a graph into a single source of which those become children.
-
Constructor Details
-
ChkDominanceAlgorithm
Constructor.- Parameters:
g
- the graphmonitor
- the monitor- Throws:
CancelledException
- if the algorithm is cancelledIllegalArgumentException
- if there are no source vertices in the graph
-
-
Method Details
-
getDominated
Returns all nodes dominated by the given vertex. A node 'a' dominates node 'b' if all paths from start to 'b' contain 'a'.- Parameters:
a
- the vertex- Returns:
- the dominated vertices
-
getDominators
Returns all nodes that dominate the given vertex. A node 'a' dominates node 'b' if all paths from start to 'b' contain 'a'.- Parameters:
a
- the vertex- Returns:
- the dominating vertices
-
getDominanceTree
Returns the dominance tree for the given graph, which is tree where each node's children are those nodes it *immediately* dominates (a idom b).- Returns:
- the dominance tree
-
clear
public void clear()Releases cached values used by internal data structures
-