Package ghidra.graph.graphs

# Class FilteringVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>

java.lang.Object
edu.uci.ics.jung.graph.AbstractGraph<V,E>
edu.uci.ics.jung.graph.AbstractTypedGraph<V,E>
edu.uci.ics.jung.graph.DirectedSparseGraph<V,E>
ghidra.graph.jung.JungDirectedGraph<V,E>
ghidra.graph.graphs.JungDirectedVisualGraph<V,E>
ghidra.graph.graphs.DefaultVisualGraph<V,E>
ghidra.graph.graphs.FilteringVisualGraph<V,E>

Type Parameters:
  `V` - the vertex type
  `E` - 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`

public abstract class FilteringVisualGraph<V extends VisualVertex,E extends VisualEdge<V>> extends DefaultVisualGraph<V,E>
A graph implementation that allows clients to mark vertices and edges as filtered. When filtered, a vertex is removed from this graph, but kept around for later unfiltering. Things of note:

- 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:
  - Serialized Form

- ## 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

  Constructors
  Constructor
  Description
  `FilteringVisualGraph()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addEdge(E e)`
  Add an edge
  `boolean`
  `addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)`
  `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`
  `addEdge(E e, V v1, V v2)`
  `boolean`
  `addEdge(E e, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)`
  `boolean`
  `addVertex(V v)`
  Add a vertex
  `void`
  `clearFilter()`
  `void`
  `dispose()`
  `void`
  `filterEdges(Collection<E> toFilter)`
  `void`
  `filterVertices(Collection<V> toFilter)`
  `Iterator<E>`
  `getAllEdges()`
  `Set<E>`
  `getAllEdges(Set<V> sourceVertices)`
  Returns all edges connected to the given vertices.
  `Set<V>`
  `getAllReachableVertices(Set<V> sourceVertices)`
  Returns all vertices that are reachable by the given vertices.
  `Iterator<V>`
  `getAllVertices()`
  `Iterator<E>`
  `getFilteredEdges()`
  `Iterator<V>`
  `getFilteredVertices()`
  `Iterator<E>`
  `getUnfilteredEdges()`
  `Iterator<V>`
  `getUnfilteredVertices()`
  `boolean`
  `isFiltered()`
  `boolean`
  `removeEdge(E e)`
  Removes an edge
  `void`
  `removeEdges(Iterable<E> toRemove)`
  Removes the given edges from the graph
  `boolean`
  `removeVertex(V v)`
  Remove a vertex
  `void`
  `removeVertices(Iterable<V> verticesToRemove)`
  Removes the given vertices from the graph
  `void`
  `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

    public void filterVertices(Collection<V> toFilter)

  - ### filterEdges

    public void filterEdges(Collection<E> toFilter)

  - ### unfilterVertices

    public void unfilterVertices(Collection<V> toUnfilter)
    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

    public void unfilterEdges(Collection<E> toUnfilter)
    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

    public Iterator<V> getAllVertices()

  - ### getAllEdges

    public Iterator<E> getAllEdges()

  - ### getFilteredVertices

    public Iterator<V> getFilteredVertices()

  - ### getFilteredEdges

    public Iterator<E> getFilteredEdges()

  - ### getUnfilteredVertices

    public Iterator<V> getUnfilteredVertices()

  - ### getUnfilteredEdges

    public Iterator<E> getUnfilteredEdges()

  - ### isFiltered

    public boolean isFiltered()

  - ### clearFilter

    public void clearFilter()

  - ### getAllReachableVertices

    public Set<V> getAllReachableVertices(Set<V> sourceVertices)
    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

    public Set<E> getAllEdges(Set<V> sourceVertices)
    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

    public boolean removeVertex(V v)
    Description copied from interface: `GDirectedGraph`
    Remove a vertex
    Specified by:
      `removeVertex` in interface `GDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Specified by:
      `removeVertex` in interface `edu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `removeVertex` in class `DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `v` - the vertex
    Returns:
      true

  - ### removeVertices

    public void removeVertices(Iterable<V> verticesToRemove)
    Description copied from interface: `GDirectedGraph`
    Removes the given vertices from the graph
    Specified by:
      `removeVertices` in interface `GDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `removeVertices` in class `DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `verticesToRemove` - the vertices to remove

  - ### removeEdge

    public boolean removeEdge(E e)
    Description copied from interface: `GDirectedGraph`
    Removes an edge
    Specified by:
      `removeEdge` in interface `GDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Specified by:
      `removeEdge` in interface `edu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `removeEdge` in class `DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `e` - the edge
    Returns:
      true if the graph contained the given edge

  - ### removeEdges

    public void removeEdges(Iterable<E> toRemove)
    Description copied from interface: `GDirectedGraph`
    Removes the given edges from the graph
    Specified by:
      `removeEdges` in interface `GDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `removeEdges` in class `JungDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `toRemove` - the edges to remove

  - ### addVertex

    public boolean addVertex(V v)
    Description copied from interface: `GDirectedGraph`
    Add a vertex
    Specified by:
      `addVertex` in interface `GDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Specified by:
      `addVertex` in interface `edu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `addVertex` in class `DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `v` - the vertex
    Returns:
      true if the add was successful, false otherwise

  - ### addEdge

    public void addEdge(E e)
    Description copied from interface: `GDirectedGraph`
    Add an edge
    Specified by:
      `addEdge` in interface `GDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `addEdge` in class `JungDirectedGraph<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 class `DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### addEdge

    public boolean addEdge(E e, Collection<? extends V> edgeVertices)
    Specified by:
      `addEdge` in interface `edu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `addEdge` in class `edu.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 interface `edu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `addEdge` in class `edu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### addEdge

    public boolean addEdge(E e, V v1, V v2)
    Specified by:
      `addEdge` in interface `edu.uci.ics.jung.graph.Graph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `addEdge` in class `edu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### addEdge

    public boolean addEdge(E e, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)
    Specified by:
      `addEdge` in interface `edu.uci.ics.jung.graph.Graph<V extends VisualVertex,E extends VisualEdge<V>>`
    Overrides:
      `addEdge` in class `edu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### addEdge

    public boolean addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)
    Overrides:
      `addEdge` in class `edu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### dispose

    public void dispose()
    Overrides:
      `dispose` in class `DefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>`