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

  • 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>, java.io.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
    • Constructor Detail

      • FilteringVisualGraph

        public FilteringVisualGraph()
    • Method Detail

      • filterVertices

        public void filterVertices​(java.util.Collection<V> toFilter)
      • filterEdges

        public void filterEdges​(java.util.Collection<E> toFilter)
      • unfilterVertices

        public void unfilterVertices​(java.util.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​(java.util.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 java.util.Iterator<V> getAllVertices()
      • getAllEdges

        public java.util.Iterator<E> getAllEdges()
      • getFilteredVertices

        public java.util.Iterator<V> getFilteredVertices()
      • getFilteredEdges

        public java.util.Iterator<E> getFilteredEdges()
      • getUnfilteredVertices

        public java.util.Iterator<V> getUnfilteredVertices()
      • getUnfilteredEdges

        public java.util.Iterator<E> getUnfilteredEdges()
      • isFiltered

        public boolean isFiltered()
      • clearFilter

        public void clearFilter()
      • getAllReachableVertices

        public java.util.Set<V> getAllReachableVertices​(java.util.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 java.util.Set<E> getAllEdges​(java.util.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
      • addEdge

        public boolean addEdge​(E e,
                               java.util.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,
                               java.util.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>>