Package ghidra.util.graph
Class DirectedGraph
java.lang.Object
ghidra.util.graph.DirectedGraph
- Direct Known Subclasses:
Dominator
,WeightedDigraph
Deprecated.
Base implementation of a directed graph. A directed graph consists
of a set of vertices (implemented as a VertexSet) and a set of edges
(implemented as an EdgeSet) joining ordered pairs of vertices in the
graph. Both vertices and edges can belong to more than one DirectedGraph.
Attributes for both vertices and edges may be defined for a DirectedGraph.
Parallel edges (more than one edge with the same from and to vertices)
are allowed in DirectedGraph. Loops are also allowed.
-
Constructor Summary
ConstructorDescriptionDeprecated.Default constructorDirectedGraph
(int vertexCapacity, int edgeCapacity) Deprecated.Creates an empty DirectedGraph with room for vertexCapacity vertices and edgeCapacity edges. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.Adds the specified edge to the graph.boolean
Deprecated.Adds the specified vertex to the graph.boolean
areRelatedAs
(Vertex parent, Vertex child) Deprecated.Returns true iff the graph contains and edge from the parent vertex to the child vertex.Deprecated.Returns an array of Sets (HashSet).void
clear()
Deprecated.Removes all vertices and edges from the graph without changing the space allocated.Deprecated.Assigns levels to the graph in a bottom up fashion.boolean
Deprecated.Returns true iff the graph contains the edge e.boolean
Deprecated.Returns true iff the vertex is in the graph.boolean
Deprecated.Returns true iff all nodes and edges of the given graph are in the current graphcopy()
Deprecated.protected void
copyAll
(DirectedGraph copy) Deprecated.Copies all attributes from the indicated directed graph to this one.protected void
copyEdge
(Edge e, DirectedGraph other) Deprecated.This method copies an edge and all object attributes from graph 'other' into this graph.protected void
copyEdgeAttributeValues
(Edge newe, Edge e, DirectedGraph other) Deprecated.This method copies the attributes from an edge 'e' from DirectedGraph 'other' into this graph associated with edge 'newe'protected void
copyVertex
(Vertex node, DirectedGraph other) Deprecated.This method copies a vertex and all object attributes from graph 'other' into this graph.protected void
copyVertexAttributeValues
(Vertex vert, DirectedGraph other) Deprecated.This method copies vertex attributes for vertex 'vert' from graph 'other' to this graph.double
Deprecated.Returns valence as a double.descendantsGraph
(Vertex[] seeds) Deprecated.Get the graph induced by the seed vertices and their descendantsDeprecated.Returns the AttributeManager for the edges of this graph.Deprecated.Returns an iterator for the EdgeSet of this graph.ghidra.util.graph.EdgeSet
edges()
Deprecated.Returns the EdgeSet of this graph.Deprecated.Returns a set of all the vertices which are ancestors of the given vertex.Deprecated.Returns a Set (HashSet) containing all vertices that are the tos of outgoing edges of the given vertex.getChildren
(Set<Vertex> vs) Deprecated.Returns all children of the vertices in the given set.Deprecated.Returns the subgraph of this graph which is the component containing v.Deprecated.Returns an array of directed graphs.Deprecated.Returns a Set (HashSet) containing all descendants of the given vertex.getDescendants
(Vertex[] seedVertices) Deprecated.Returns a Set (HashSet) of all vertices descended from a vertex in the given array.Edge[]
Deprecated.returns an array containing the edges in the graphprotected ObjectAttribute
<Edge> getEdgeAttribute
(String attribName) Deprecated.This method gets and ObjectAttribute method give an attribute name.protected Object
getEdgeProperty
(String propName, Edge e) Deprecated.This is a helper method that gets a property named propName to from edge e.getEdges()
Deprecated.returns a java.util.Set containing the edges in this graph.Edge[]
Deprecated.Returns all edges joing the from and to vertices.getEdgeWithKey
(long key) Deprecated.Deprecated.Returns a vector containing the entry points to a directed graph.Deprecated.Returns a Set containing all of the edges to the given vertex.Deprecated.This method assigns levels in a top-down manner.Deprecated.Returns a java.util.Set containing the vertex v and its neighbors.getNeighborhood
(Set<Vertex> vs) Deprecated.Returns a java.util.Set containing the vertices in the given Set and their neighbors.Deprecated.Returns the outgoing edges from the given vertex.getParents
(Vertex v) Deprecated.Returns a Set containg all of the vertices from which an edge comes into the given vertex.getParents
(Set<Vertex> vs) Deprecated.Returns all parents of the vertices in the given set.Deprecated.Returns the referent of the object used to create v if it exists.Vertex[]
getSinks()
Deprecated.Returns a Vertex[] containing the sinks.Vertex[]
Deprecated.Returns a Vertex[] containing the sources.Vertex[]
Deprecated.returns an array containing the vertices in the graphprotected ObjectAttribute
<Vertex> getVertexAttribute
(String attribName) Deprecated.This method gets and ObjectAttribute method give an attribute name.protected Object
getVertexProperty
(String propName, Vertex v) Deprecated.This is a helper method that gets a property named propName for vertex v.getVertexWithKey
(long key) Deprecated.Deprecated.returns a java.util.Set containing the vertices in this graph.Vertex[]
Deprecated.Returns Vertex[] containing all vertices having the given object as a referent.Deprecated.Returns a java.util.Set containing all of the vertices within the same component a the given vertex.Edge[]
Deprecated.Returns an array of all incoming edges.double
Deprecated.Returns inValence as a double.inducedSubgraph
(Vertex[] vertexSet) Deprecated.Returns the directed graph which is subgraph induced by the given set of vertices.void
intersectionWith
(DirectedGraph otherGraph) Deprecated.Creates intersection of graphs in place by adding all vertices and edges of other graph to this graph.int
Deprecated.The number of edges having v as their terminal or "to" vertex.join
(DirectedGraph other) Deprecated.This method joins nodes from a directed graph into this.double
loopDegree
(Vertex v) Deprecated.Returns numLoops as a double.int
numEdges()
Deprecated.Returns the number of edges in the graphint
Deprecated.The number of edges having v as both their terminal and terminal vertex.int
numSinks()
Deprecated.returns the number of vertices with outValence zero.int
Deprecated.returns the number of vertices with inValence zero.int
Deprecated.Returns the number of vertices in the graphdouble
Deprecated.Returns outValence as a double.Edge[]
Deprecated.Returns an array of all outgoing edges.int
outValence
(Vertex v) Deprecated.The number of edges having v as their initial or "from" vertex.boolean
Deprecated.Removes Edge e from the graph.boolean
Deprecated.Removes the vertex v from the graph.Edge[]
Deprecated.Returns an array of all edges with the given vertex as both the from and to.protected void
setEdgeProperty
(String propName, Edge e, Object prop) Deprecated.This is a helper method that sets a object property named propName to edge e.protected void
setVertexProperty
(String propName, Vertex v, Object prop) Deprecated.This is a helper method that sets an object property named propName for Vertex v.void
unionWith
(DirectedGraph otherGraph) Deprecated.Creates union of graphs in place by adding all vertices and edges of other graph to this graph.int
Deprecated.The number of edges incident with v.Deprecated.Returns the AttributeManager for the vertices of this graph.Deprecated.Returns an iterator for the VertexSet of this graph.ghidra.util.graph.VertexSet
vertices()
Deprecated.Returns the VertexSet of this graph.Vertex[]
Deprecated.Returns array of all vertices unreachable from a source.static Set
<?> verts2referentSet
(Collection<Vertex> verts) Deprecated.This method converts a collection of verticies into a set of its referent objects.
-
Constructor Details
-
DirectedGraph
public DirectedGraph(int vertexCapacity, int edgeCapacity) Deprecated.Creates an empty DirectedGraph with room for vertexCapacity vertices and edgeCapacity edges. -
DirectedGraph
public DirectedGraph()Deprecated.Default constructor
-
-
Method Details
-
inValence
Deprecated.The number of edges having v as their terminal or "to" vertex. -
outValence
Deprecated.The number of edges having v as their initial or "from" vertex. -
numLoops
Deprecated.The number of edges having v as both their terminal and terminal vertex. -
valence
Deprecated.The number of edges incident with v. For unweighted graphs valence and degree are the same, except valence is an int while degree is a double. -
edges
public ghidra.util.graph.EdgeSet edges()Deprecated.Returns the EdgeSet of this graph. -
getEdgeWithKey
Deprecated.- Parameters:
key
-- Returns:
- the edge in the graph with the specified key or null if the graph does not contain an edge with the key.
-
vertices
public ghidra.util.graph.VertexSet vertices()Deprecated.Returns the VertexSet of this graph. -
getVertexWithKey
Deprecated.- Parameters:
key
-- Returns:
- the vertex in the graph with the specified key or null if the graph does not contain an vertex with the key.
-
getChildren
Deprecated.Returns a Set (HashSet) containing all vertices that are the tos of outgoing edges of the given vertex. Note in the case of multiple edges, the number of children and outvalence need not be the same. -
getOutgoingEdges
Deprecated.Returns the outgoing edges from the given vertex. -
getParents
Deprecated.Returns a Set containg all of the vertices from which an edge comes into the given vertex. -
getIncomingEdges
Deprecated.Returns a Set containing all of the edges to the given vertex. -
getChildren
Deprecated.Returns all children of the vertices in the given set. -
getParents
Deprecated.Returns all parents of the vertices in the given set. -
getDescendants
Deprecated.Returns a Set (HashSet) containing all descendants of the given vertex. Note: The vertex is defined to be a descendant of itself. -
incomingEdges
Deprecated.Returns an array of all incoming edges. -
outgoingEdges
Deprecated.Returns an array of all outgoing edges. -
selfEdges
Deprecated.Returns an array of all edges with the given vertex as both the from and to. -
verticesUnreachableFromSources
Deprecated.Returns array of all vertices unreachable from a source. These are the vertices descending only from a non-trivial strongly connected component. -
getDescendants
Deprecated.Returns a Set (HashSet) of all vertices descended from a vertex in the given array. -
getAncestors
Deprecated.Returns a set of all the vertices which are ancestors of the given vertex. Note: By definition a vertex is one of its own ancestors. -
edgeIterator
Deprecated.Returns an iterator for the EdgeSet of this graph. -
vertexIterator
Deprecated.Returns an iterator for the VertexSet of this graph. -
inDegree
Deprecated.Returns inValence as a double. Should be overridden extending classes. -
outDegree
Deprecated.Returns outValence as a double. Should be overridden extending classes. -
loopDegree
Deprecated.Returns numLoops as a double. Should be overridden extending classes. -
degree
Deprecated.Returns valence as a double. Should be overridden extending classes. -
containsAsSubgraph
Deprecated.Returns true iff all nodes and edges of the given graph are in the current graph -
assignVerticesToStrongComponents
Deprecated.Returns an array of Sets (HashSet). Each set contains the vertices within a single strongly connected component of the DirectedGraph. A strongly connected component of a directed graph is a subgraph in which it is possible to find a directed path from any vertex to any other vertex in the graph. A cycle is a simple example of strongly connected graph. -
getEntryPoints
Deprecated.Returns a vector containing the entry points to a directed graph. An entry point is either a source (in valence zero) or the least vertex in a strongly connected component unreachable from any vertex outside the strongly connected component. Least is defined here to be the vertex with the smallest key. -
getVertices
Deprecated.returns a java.util.Set containing the vertices in this graph. -
getVertexArray
Deprecated.returns an array containing the vertices in the graph -
getEdges
Deprecated.returns a java.util.Set containing the edges in this graph. -
getEdgeArray
Deprecated.returns an array containing the edges in the graph -
numVertices
public int numVertices()Deprecated.Returns the number of vertices in the graph -
numEdges
public int numEdges()Deprecated.Returns the number of edges in the graph -
add
Deprecated.Adds the specified vertex to the graph. -
add
Deprecated.Adds the specified edge to the graph. If either endpoint of the edge is not in the graph that vertex is also added to the graph. -
remove
Deprecated.Removes the vertex v from the graph. Also removes all edges incident with v. Does nothing if the vertex is not in the graph. -
remove
Deprecated.Removes Edge e from the graph. No effect if the edge is not in the graph. -
contains
Deprecated.Returns true iff the vertex is in the graph. -
contains
Deprecated.Returns true iff the graph contains the edge e. -
numSinks
public int numSinks()Deprecated.returns the number of vertices with outValence zero. -
numSources
public int numSources()Deprecated.returns the number of vertices with inValence zero. -
getSources
Deprecated.Returns a Vertex[] containing the sources. A vertex is a source if it has no incoming edges. -
getSinks
Deprecated.Returns a Vertex[] containing the sinks. A vertex is a sink if it has no outgoing edges. -
getVerticesInContainingComponent
Deprecated.Returns a java.util.Set containing all of the vertices within the same component a the given vertex. -
getComponentContaining
Deprecated.Returns the subgraph of this graph which is the component containing v. -
getComponents
Deprecated.Returns an array of directed graphs. Each array element is a DirectedGraph consisting of a single connected component of this graph. -
intersectionWith
Deprecated.Creates intersection of graphs in place by adding all vertices and edges of other graph to this graph. This method used to return a different graph as the intersection but now does not. -
unionWith
Deprecated.Creates union of graphs in place by adding all vertices and edges of other graph to this graph. This method used to return a different graph as the union but now does not. -
descendantsGraph
Deprecated.Get the graph induced by the seed vertices and their descendants -
inducedSubgraph
Deprecated.Returns the directed graph which is subgraph induced by the given set of vertices. The vertex set of the returned graph contains the given vertices which belong to this graph. An edge of this graph is in the returned graph iff both endpoints belong to the given vertices. -
getNeighborhood
Deprecated.Returns a java.util.Set containing the vertex v and its neighbors. -
getNeighborhood
Deprecated.Returns a java.util.Set containing the vertices in the given Set and their neighbors. -
getReferent
Deprecated.Returns the referent of the object used to create v if it exists. If the vertex was created with a null referent this method returns null. -
getLevels
Deprecated.This method assigns levels in a top-down manner. Sources are on level 0. -
complexityDepth
Deprecated.Assigns levels to the graph in a bottom up fashion. All sinks have the same level. -
getEdges
Deprecated.Returns all edges joing the from and to vertices. Recall DirectedGraph uses a multigraph model where parallel edges are allowed. -
areRelatedAs
Deprecated.Returns true iff the graph contains and edge from the parent vertex to the child vertex. -
clear
public void clear()Deprecated.Removes all vertices and edges from the graph without changing the space allocated. -
vertexAttributes
Deprecated.Returns the AttributeManager for the vertices of this graph. -
edgeAttributes
Deprecated.Returns the AttributeManager for the edges of this graph. -
getVerticesHavingReferent
Deprecated.Returns Vertex[] containing all vertices having the given object as a referent. Any number of vertices in the graph may refer back to the same object. -
copy
Deprecated.- Returns:
- A directed graph with the same vertices, edges, and attributes.
-
copyAll
Deprecated.Copies all attributes from the indicated directed graph to this one.- Parameters:
copy
- the directed graph to copy from.
-
copyVertex
Deprecated.This method copies a vertex and all object attributes from graph 'other' into this graph.- Parameters:
node
-other
-
-
copyEdge
Deprecated.This method copies an edge and all object attributes from graph 'other' into this graph. Any implicictly created Verticies do not get their attribute values copied -- you must use copyVertex.- Parameters:
e
-other
-
-
copyEdgeAttributeValues
Deprecated.This method copies the attributes from an edge 'e' from DirectedGraph 'other' into this graph associated with edge 'newe'- Parameters:
newe
-e
-other
-
-
join
Deprecated.This method joins nodes from a directed graph into this. This allows DirectedGraph subclasses to copy nodes and attributes, a shortcomings with the unionWith method.- Parameters:
other
- the other directed graph that is to be joined into this one.- Returns:
- this directed graph
-
copyVertexAttributeValues
Deprecated.This method copies vertex attributes for vertex 'vert' from graph 'other' to this graph.- Parameters:
vert
- the vertex whose attributes should be copied.other
- the other graph to copy vertex attributes from
-
setEdgeProperty
Deprecated.This is a helper method that sets a object property named propName to edge e. -
getEdgeProperty
Deprecated.This is a helper method that gets a property named propName to from edge e.- Parameters:
propName
- the property namee
- the edge- Returns:
- the attribute for the indicated edge
-
setVertexProperty
Deprecated.This is a helper method that sets an object property named propName for Vertex v.- Parameters:
propName
- the property namev
- the vertexprop
- the property value
-
getVertexProperty
Deprecated.This is a helper method that gets a property named propName for vertex v.- Parameters:
propName
- the property namev
- the vertex- Returns:
- the property value
-
getEdgeAttribute
Deprecated.This method gets and ObjectAttribute method give an attribute name. If it is not found in the attribute manager, the attribute is created automatically.- Parameters:
attribName
- the name of the attribute- Returns:
- the attribute
-
getVertexAttribute
Deprecated.This method gets and ObjectAttribute method give an attribute name. If it is not found in the attribute manager, the attribute is created automatically.- Parameters:
attribName
- the attribute name- Returns:
- the attribute
-
verts2referentSet
Deprecated.This method converts a collection of verticies into a set of its referent objects. It is up to the methods using the created set to properly type cast the set's elements.- Parameters:
verts
- the vertices- Returns:
- the set of referent objects
-