Class SortedSparseMultigraph<V,​E>

  • All Implemented Interfaces:
    edu.uci.ics.jung.graph.Graph<V,​E>, edu.uci.ics.jung.graph.Hypergraph<V,​E>, edu.uci.ics.jung.graph.MultiGraph<V,​E>, java.io.Serializable

    public class SortedSparseMultigraph<V,​E>
    extends OrderedSparseMultigraph<V,​E>
    implements edu.uci.ics.jung.graph.MultiGraph<V,​E>
    An implementation of Graph that is suitable for sparse graphs, orders its vertex and edge collections according to either specified Comparator instances or the natural ordering of their elements, and permits directed, undirected, and parallel edges.
    See Also:
    Serialized Form
    • Field Detail

      • vertex_comparator

        protected java.util.Comparator<V> vertex_comparator
        Comparator used in ordering vertices. Defaults to util.ComparableComparator if no comparators are specified in the constructor.
      • edge_comparator

        protected java.util.Comparator<E> edge_comparator
        Comparator used in ordering edges. Defaults to util.ComparableComparator if no comparators are specified in the constructor.
    • Constructor Detail

      • SortedSparseMultigraph

        public SortedSparseMultigraph​(java.util.Comparator<V> vertex_comparator,
                                      java.util.Comparator<E> edge_comparator)
        Creates a new instance which sorts its vertices and edges according to the specified Comparators.
      • SortedSparseMultigraph

        public SortedSparseMultigraph()
        Creates a new instance which sorts its vertices and edges according to their natural ordering.
    • Method Detail

      • getFactory

        public static <V,​E> org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.Graph<V,​E>> getFactory()
        Returns a Factory that creates an instance of this graph type.
        Type Parameters:
        V - the vertex type for the graph factory
        E - the edge type for the graph factory
      • setVertexComparator

        public void setVertexComparator​(java.util.Comparator<V> vertex_comparator)
        Provides a new Comparator to be used in sorting the vertices.
        Parameters:
        vertex_comparator - the comparator that defines the new ordering
      • addVertex

        public boolean addVertex​(V vertex)
        Specified by:
        addVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
        Overrides:
        addVertex in class OrderedSparseMultigraph<V,​E>