Class FilteringVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
edu.uci.ics.jung.graph.DirectedGraph<V,
,E> edu.uci.ics.jung.graph.Graph<V,
,E> edu.uci.ics.jung.graph.Hypergraph<V,
,E> GDirectedGraph<V,
,E> GImplicitDirectedGraph<V,
,E> VisualGraph<V,
,E> Serializable
- As vertices are filtered, so to will be their edges
- If additions are made to the graph while it is filtered, the new additions will not be added to the current graph, but will be kept in the background for later restoring
Implementation Note: this class engages in some odd behavior when removals and additions are need to this graph. A distinction is made between events that are generated from external clients and those that happen due to filtering and restoring. This distinction allows this class to know when to update this graph, based upon whether or not data has been filtered. Implementation of this is achieved by using a flag. Currently, this flag is thread-safe. If this graph is to be multi-threaded (such as if changes are to be made by multiple threads, then this update flag will have to be revisited to ensure thread visibility.
- See Also:
-
Field Summary
Fields inherited from class ghidra.graph.graphs.DefaultVisualGraph
focusedVertex
Fields inherited from class edu.uci.ics.jung.graph.DirectedSparseGraph
edges, vertices
Fields inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
edge_type
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an edgeboolean
boolean
addEdge
(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType type) boolean
addEdge
(E e, Collection<? extends V> edgeVertices) boolean
addEdge
(E e, Collection<? extends V> edgeVertices, edu.uci.ics.jung.graph.util.EdgeType type) boolean
boolean
boolean
Add a vertexvoid
void
dispose()
void
filterEdges
(Collection<E> toFilter) void
filterVertices
(Collection<V> toFilter) getAllEdges
(Set<V> sourceVertices) Returns all edges connected to the given vertices.getAllReachableVertices
(Set<V> sourceVertices) Returns all vertices that are reachable by the given vertices.boolean
boolean
removeEdge
(E e) Removes an edgevoid
removeEdges
(Iterable<E> toRemove) Removes the given edges from the graphboolean
removeVertex
(V v) Remove a vertexvoid
removeVertices
(Iterable<V> verticesToRemove) Removes the given vertices from the graphvoid
unfilterEdges
(Collection<E> toUnfilter) Restores the given filtered edges into the graph.void
unfilterVertices
(Collection<V> toUnfilter) Restores the given filtered vertices into the graph.Methods inherited from class ghidra.graph.graphs.DefaultVisualGraph
addGraphChangeListener, clearSelectedVertices, copy, fireEdgesAdded, fireEdgesRemoved, fireVerticesAdded, fireVerticesRemoved, getAllEdges, getEdges, getFocusedVertex, getSelectedVertices, initializeLocation, removeGraphChangeListener, setSelectedVertices, setVertexFocused, vertexLocationChanged, verticesAdded, verticesRemoved
Methods inherited from class ghidra.graph.jung.JungDirectedGraph
containsEdge, emptyCopy, isEmpty
Methods inherited from class edu.uci.ics.jung.graph.DirectedSparseGraph
containsEdge, containsVertex, findEdge, findEdgeSet, getDest, getEdgeCount, getEdges, getEndpoints, getFactory, getIncidentEdges, getIncoming_internal, getInEdges, getNeighbors, getOutEdges, getOutgoing_internal, getPredecessors, getPreds_internal, getSource, getSuccessors, getSuccs_internal, getVertexCount, getVertices, isDest, isSource
Methods inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, hasEqualEdgeType, validateEdgeType
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
degree, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ghidra.graph.GDirectedGraph
containsEdge, containsEdge, containsVertex, emptyCopy, findEdge, getEdgeCount, getEdges, getIncidentEdges, getInEdges, getOutEdges, getPredecessors, getSuccessors, getVertexCount, getVertices, isEmpty
Methods inherited from interface edu.uci.ics.jung.graph.Graph
getOpposite, getPredecessorCount, getSuccessorCount, inDegree, isPredecessor, isSuccessor, outDegree
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph
degree, getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, getIncidentCount, getIncidentVertices, getNeighborCount, isIncident, isNeighbor
Methods inherited from interface ghidra.graph.VisualGraph
getLayout
-
Constructor Details
-
FilteringVisualGraph
public FilteringVisualGraph()
-
-
Method Details
-
filterVertices
-
filterEdges
-
unfilterVertices
Restores the given filtered vertices into the graph. This will only happen if both endpoints are in the graph.- Parameters:
toUnfilter
- the edges to restore
-
unfilterEdges
Restores the given filtered edges into the graph. This will only happen if both endpoints are in the graph.- Parameters:
toUnfilter
- the edges to restore
-
getAllVertices
-
getAllEdges
-
getFilteredVertices
-
getFilteredEdges
-
getUnfilteredVertices
-
getUnfilteredEdges
-
isFiltered
public boolean isFiltered() -
clearFilter
public void clearFilter() -
getAllReachableVertices
Returns all vertices that are reachable by the given vertices.This method is needed if you wish to find relationships that have been filtered out.
- Parameters:
sourceVertices
- the vertices for which to find the other reachable vertices- Returns:
- the reachable vertices
-
getAllEdges
Returns all edges connected to the given vertices.This method is needed if you wish to find relationships that have been filtered out.
- Parameters:
sourceVertices
- the vertices for which to get the edges- Returns:
- the reachable edges
-
removeVertex
Description copied from interface:GDirectedGraph
Remove a vertex- Specified by:
removeVertex
in interfaceGDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Specified by:
removeVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
removeVertex
in classDefaultVisualGraph<V extends VisualVertex,
E extends VisualEdge<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 extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
removeVertices
in classDefaultVisualGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Parameters:
verticesToRemove
- the vertices to remove
-
removeEdge
Description copied from interface:GDirectedGraph
Removes an edge- Specified by:
removeEdge
in interfaceGDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Specified by:
removeEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
removeEdge
in classDefaultVisualGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Parameters:
e
- the edge- Returns:
- true if the graph contained the given edge
-
removeEdges
Description copied from interface:GDirectedGraph
Removes the given edges from the graph- Specified by:
removeEdges
in interfaceGDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
removeEdges
in classJungDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Parameters:
toRemove
- the edges to remove
-
addVertex
Description copied from interface:GDirectedGraph
Add a vertex- Specified by:
addVertex
in interfaceGDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Specified by:
addVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
addVertex
in classDefaultVisualGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Parameters:
v
- the vertex- Returns:
- true if the add was successful, false otherwise
-
addEdge
Description copied from interface:GDirectedGraph
Add an edge- Specified by:
addEdge
in interfaceGDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
addEdge
in classJungDirectedGraph<V extends VisualVertex,
E extends VisualEdge<V>> - Parameters:
e
- the edge
-
addEdge
public boolean addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType type) - Overrides:
addEdge
in classDefaultVisualGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-
addEdge
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, Collection<? extends V> edgeVertices, edu.uci.ics.jung.graph.util.EdgeType type) - Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-
addEdge
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-
addEdge
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<V extends VisualVertex,
E extends VisualEdge<V>> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-
addEdge
- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-
dispose
public void dispose()- Overrides:
dispose
in classDefaultVisualGraph<V extends VisualVertex,
E extends VisualEdge<V>>
-