Class MutableGDirectedGraphWrapper<V,E extends GEdge<V>>
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
GDirectedGraph<V,
,E> GImplicitDirectedGraph<V,
E>
GDirectedGraph
and allows for vertex and edge additions
without changing the underlying graph.
Warning: As mentioned above, this graph is meant for additive operations. In its
current form, removal operations will not work. To facilitate removals, this class will
have to be updated to track removed vertices and edges, using them to correctly report
the state of the graph for methods like containsVertex(Object)
and
containsEdge(GEdge)
.
Implementation Note: there is some 'magic' in this class to add 'dummy' vertices to the
graph. To facilitate this, the mutated graph in this class does not have the V
type, but rather is typed on Object. This means that this class can only be used
generically, with templated types (like by algorithms and such). Any usage of this class
that expects concrete implementations to be returned can trigger ClassCastExceptions.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDummyEdge
(V start, V end) addDummyVertex
(String name) void
Add an edgeboolean
Add a vertexboolean
containsEdge
(E e) Test if the graph contains a given edgeboolean
containsEdge
(V from, V to) Test if the graph contains an edge from one given vertex to anotherboolean
containsVertex
(V v) Test if the graph contains a given vertexcopy()
Copy this graph.Creates a new instance of this graph with no vertices or edges.Locates the edge object for the two verticesint
Count the number of edges in the graphgetEdges()
Retrieve all the edgesgetInEdges
(V v) Compute the incident edges that end at the given vertexgetOutEdges
(V v) Compute the incident edges that start at the given vertexgetPredecessors
(V v) Compute a vertex's predecessorsgetSuccessors
(V v) Compute a vertex's successorsint
Count the number of vertices in the graphRetrieve all the verticesboolean
boolean
boolean
isEmpty()
Test if the graph is empty, i.e., contains no vertices or edgesboolean
removeEdge
(E e) Removes an edgevoid
removeEdges
(Iterable<E> edges) Removes the given edges from the graphboolean
removeVertex
(V v) Remove a vertexvoid
removeVertices
(Iterable<V> vertices) Removes the given vertices from the graphMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.graph.GDirectedGraph
getIncidentEdges
-
Constructor Details
-
MutableGDirectedGraphWrapper
-
-
Method Details
-
addDummyVertex
-
isDummy
-
isDummy
-
addDummyEdge
-
addVertex
Description copied from interface:GDirectedGraph
Add a vertex -
removeVertex
Description copied from interface:GDirectedGraph
Remove a vertex- Specified by:
removeVertex
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
v
- the vertex- Returns:
- true
-
removeVertices
Description copied from interface:GDirectedGraph
Removes the given vertices from the graph- Specified by:
removeVertices
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
vertices
- the vertices to remove
-
removeEdges
Description copied from interface:GDirectedGraph
Removes the given edges from the graph- Specified by:
removeEdges
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
edges
- the edges to remove
-
addEdge
Description copied from interface:GDirectedGraph
Add an edge -
removeEdge
Description copied from interface:GDirectedGraph
Removes an edge- Specified by:
removeEdge
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
e
- the edge- Returns:
- true if the graph contained the given edge
-
getVertices
Description copied from interface:GDirectedGraph
Retrieve all the vertices- Specified by:
getVertices
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Returns:
- the vertices
-
getEdges
Description copied from interface:GDirectedGraph
Retrieve all the edges -
containsVertex
Description copied from interface:GDirectedGraph
Test if the graph contains a given vertex- Specified by:
containsVertex
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
v
- the vertex- Returns:
- true if the vertex is in the graph, or false
-
containsEdge
Description copied from interface:GDirectedGraph
Test if the graph contains a given edge- Specified by:
containsEdge
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
e
- the ege- Returns:
- true if the edge is in the graph, or false
-
containsEdge
Description copied from interface:GDirectedGraph
Test if the graph contains an edge from one given vertex to another- Specified by:
containsEdge
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Parameters:
from
- the source vertexto
- the destination vertex- Returns:
- true if such an edge exists, or false
-
findEdge
Description copied from interface:GDirectedGraph
Locates the edge object for the two vertices -
isEmpty
public boolean isEmpty()Description copied from interface:GDirectedGraph
Test if the graph is empty, i.e., contains no vertices or edges -
getVertexCount
public int getVertexCount()Description copied from interface:GDirectedGraph
Count the number of vertices in the graph- Specified by:
getVertexCount
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Returns:
- the count
-
getEdgeCount
public int getEdgeCount()Description copied from interface:GDirectedGraph
Count the number of edges in the graph- Specified by:
getEdgeCount
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Returns:
- the count
-
getInEdges
Description copied from interface:GDirectedGraph
Compute the incident edges that end at the given vertex- Specified by:
getInEdges
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Specified by:
getInEdges
in interfaceGImplicitDirectedGraph<V,
E extends GEdge<V>> - Parameters:
v
- the destination vertex- Returns:
- the in-edges to the given vertex
-
getOutEdges
Description copied from interface:GDirectedGraph
Compute the incident edges that start at the given vertex- Specified by:
getOutEdges
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Specified by:
getOutEdges
in interfaceGImplicitDirectedGraph<V,
E extends GEdge<V>> - Parameters:
v
- the source vertex- Returns:
- the out-edges from the given vertex
-
getPredecessors
Description copied from interface:GDirectedGraph
Compute a vertex's predecessorsThe default implementation computes this from the in-edges
- Specified by:
getPredecessors
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Specified by:
getPredecessors
in interfaceGImplicitDirectedGraph<V,
E extends GEdge<V>> - Parameters:
v
- the destination vertex- Returns:
- the predecessors
-
getSuccessors
Description copied from interface:GDirectedGraph
Compute a vertex's successorsThe default implementation compute this from the out-edges
- Specified by:
getSuccessors
in interfaceGDirectedGraph<V,
E extends GEdge<V>> - Specified by:
getSuccessors
in interfaceGImplicitDirectedGraph<V,
E extends GEdge<V>> - Parameters:
v
- the source vertex- Returns:
- the successors
-
copy
Description copied from interface:GDirectedGraph
Copy this graph.Note: the vertices and edges in the copy may be the same instances in the new graph and not themselves copies.
-
emptyCopy
Description copied from interface:GDirectedGraph
Creates a new instance of this graph with no vertices or edges. This is useful when you wish to build a new graph using the same type as this graph.
-