java.lang.Object
org.jgrapht.graph.AbstractGraph<V,E>
org.jgrapht.graph.AbstractBaseGraph<java.lang.Integer,E>
org.jgrapht.opt.graph.fastutil.FastutilMapIntVertexGraph<E>
- Type Parameters:
E
- the graph edge type
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Graph<java.lang.Integer,E>
public class FastutilMapIntVertexGraph<E> extends AbstractBaseGraph<java.lang.Integer,E>
A graph implementation using fastutil's map implementations for storage specialized
for integer vertices. Edges can be of any object type.
The following example creates a simple undirected weighted graph:
Graph<Integer, DefaultWeightedEdge> g = new FastutilMapIntVertexGraph<>( SupplierUtil.createIntegerSupplier(), SupplierUtil.createDefaultWeightedEdgeSupplier(), DefaultGraphType.simple().asWeighted());
- Author:
- Dimitrios Michail
- See Also:
FastutilMapGraph
, Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FastutilMapIntVertexGraph(java.util.function.Supplier<java.lang.Integer> vertexSupplier, java.util.function.Supplier<E> edgeSupplier, GraphType type)
Construct a new graph.FastutilMapIntVertexGraph(java.util.function.Supplier<java.lang.Integer> vertexSupplier, java.util.function.Supplier<E> edgeSupplier, GraphType type, boolean fastLookups)
Construct a new graph. -
Method Summary
Methods inherited from class org.jgrapht.graph.AbstractBaseGraph
addEdge, addEdge, addVertex, addVertex, clone, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getEdgeWeight, getType, getVertexSupplier, incomingEdgesOf, inDegreeOf, iterables, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, setEdgeSupplier, setEdgeWeight, setVertexSupplier, vertexSet
Methods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSets
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jgrapht.Graph
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices, setEdgeWeight
-
Constructor Details
-
FastutilMapIntVertexGraph
public FastutilMapIntVertexGraph(java.util.function.Supplier<java.lang.Integer> vertexSupplier, java.util.function.Supplier<E> edgeSupplier, GraphType type, boolean fastLookups)Construct a new graph.- Parameters:
vertexSupplier
- the vertex supplier, can be nulledgeSupplier
- the edge supplier, can be nulltype
- the graph typefastLookups
- whether to index vertex pairs to allow (expected) constant time edge lookups (by vertex endpoints)- Throws:
java.lang.IllegalArgumentException
- if the graph type is not supported by this implementation
-
FastutilMapIntVertexGraph
public FastutilMapIntVertexGraph(java.util.function.Supplier<java.lang.Integer> vertexSupplier, java.util.function.Supplier<E> edgeSupplier, GraphType type)Construct a new graph.By default we index vertex pairs to allow (expected) constant time edge lookups.
- Parameters:
vertexSupplier
- the vertex supplier, can be nulledgeSupplier
- the edge supplier, can be nulltype
- the graph type- Throws:
java.lang.IllegalArgumentException
- if the graph type is not supported by this implementation
-