Package ghidra.graph.algo
Class GraphNavigator<V,E extends GEdge<V>>
java.lang.Object
ghidra.graph.algo.GraphNavigator<V,E>
- Type Parameters:
V
- the vertex typeE
- the edge type
The methods on this interface are meant to enable graph traversal in a way that allows
the underlying graph to be walked from top-down or bottom-up.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V,
E extends GEdge<V>>
GraphNavigator<V, E> Creates a bottom-down navigator, which is one that traverses the graph from the sink to the source.getEdges
(GDirectedGraph<V, E> graph, V v) Gets all edges leaving the given vertex, depending upon the direction of this navigator.Gets the vertex at the end of the given edge, where the 'end' of the edge depends on the start vertex.getPredecessors
(GDirectedGraph<V, E> graph, V v) Gets all parent vertices of the given vertex, depending upon the direction of the navigator.getSinks
(GDirectedGraph<V, E> graph) Gets the exit vertices of the given graph.getSources
(GDirectedGraph<V, E> graph) Gets the root vertices of the given graph.getSuccessors
(GDirectedGraph<V, E> graph, V v) Gets all child vertices of the given vertex, depending upon the direction of the navigator.getVerticesInPostOrder
(GDirectedGraph<V, E> graph) Returns all vertices in the given graph in the depth-first order.boolean
Returns true if this navigator processes nodes from the top down; false if nodes are processed from the bottom up.static <V,
E extends GEdge<V>>
GraphNavigator<V, E> Creates a top-down navigator, which is one that traverses the graph from the source to the sink.
-
Method Details
-
getEdges
Gets all edges leaving the given vertex, depending upon the direction of this navigator.- Parameters:
graph
- the graphv
- the vertex- Returns:
- the edges
-
isTopDown
public boolean isTopDown()Returns true if this navigator processes nodes from the top down; false if nodes are processed from the bottom up.- Returns:
- true if this navigator processes nodes from the top down; false if nodes are processed from the bottom up.
-
getSuccessors
Gets all child vertices of the given vertex, depending upon the direction of the navigator.- Parameters:
graph
- the graphv
- the vertex- Returns:
- the vertices
-
getPredecessors
Gets all parent vertices of the given vertex, depending upon the direction of the navigator.- Parameters:
graph
- the graphv
- the vertex- Returns:
- the vertices
-
getEnd
Gets the vertex at the end of the given edge, where the 'end' of the edge depends on the start vertex.- Parameters:
e
- the edge- Returns:
- the vertex
-
getSources
Gets the root vertices of the given graph. If this is a top-down navigator, then the sources are returned; otherwise, the sinks are returned.- Parameters:
graph
- the graph- Returns:
- the roots
-
getSinks
Gets the exit vertices of the given graph. If this is a top-down navigator, then the sinks are returned; otherwise, the sources are returned.- Parameters:
graph
- the graph- Returns:
- the exits
-
getVerticesInPostOrder
Returns all vertices in the given graph in the depth-first order. The order will be post-order for a top-down navigator and pre-order for a bottom-up navigator.- Parameters:
graph
- the graph- Returns:
- the ordered vertices