Package edu.uci.ics.jung.graph
Class SortedSparseMultigraph<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.graph.AbstractGraph<V,E>
-
- edu.uci.ics.jung.graph.SparseMultigraph<V,E>
-
- edu.uci.ics.jung.graph.OrderedSparseMultigraph<V,E>
-
- edu.uci.ics.jung.graph.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 ofGraphthat is suitable for sparse graphs, orders its vertex and edge collections according to either specifiedComparatorinstances or the natural ordering of their elements, and permits directed, undirected, and parallel edges.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Comparator<E>edge_comparatorComparatorused in ordering edges.protected java.util.Comparator<V>vertex_comparatorComparatorused in ordering vertices.-
Fields inherited from class edu.uci.ics.jung.graph.SparseMultigraph
directedEdges, edges, vertices
-
-
Constructor Summary
Constructors Constructor Description SortedSparseMultigraph()Creates a new instance which sorts its vertices and edges according to their natural ordering.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 specifiedComparators.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddVertex(V vertex)static <V,E>
org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.Graph<V,E>>getFactory()Returns aFactorythat creates an instance of this graph type.voidsetVertexComparator(java.util.Comparator<V> vertex_comparator)Provides a newComparatorto be used in sorting the vertices.-
Methods inherited from class edu.uci.ics.jung.graph.OrderedSparseMultigraph
getIncidentEdges, getNeighbors, getPredecessors, getSuccessors
-
Methods inherited from class edu.uci.ics.jung.graph.SparseMultigraph
addEdge, containsEdge, containsVertex, findEdge, getDefaultEdgeType, getDest, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getEndpoints, getIncoming_internal, getInEdges, getOutEdges, getOutgoing_internal, getSource, getVertexCount, getVertices, isDest, isSource, removeEdge, removeVertex
-
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
addEdge, addEdge, addEdge, addEdge, addEdge, degree, findEdgeSet, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toString
-
-
-
-
Field Detail
-
vertex_comparator
protected java.util.Comparator<V> vertex_comparator
Comparatorused in ordering vertices. Defaults toutil.ComparableComparatorif no comparators are specified in the constructor.
-
edge_comparator
protected java.util.Comparator<E> edge_comparator
Comparatorused in ordering edges. Defaults toutil.ComparableComparatorif 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 specifiedComparators.
-
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 aFactorythat creates an instance of this graph type.- Type Parameters:
V- the vertex type for the graph factoryE- the edge type for the graph factory
-
setVertexComparator
public void setVertexComparator(java.util.Comparator<V> vertex_comparator)
Provides a newComparatorto be used in sorting the vertices.- Parameters:
vertex_comparator- the comparator that defines the new ordering
-
-