Package org.jgrapht.opt.graph.fastutil
Class FastutilMapGraph<V,E>
- java.lang.Object
-
- org.jgrapht.graph.AbstractGraph<V,E>
-
- org.jgrapht.graph.AbstractBaseGraph<V,E>
-
- org.jgrapht.opt.graph.fastutil.FastutilMapGraph<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
Serializable
,Cloneable
,Graph<V,E>
public class FastutilMapGraph<V,E> extends AbstractBaseGraph<V,E>
A graph implementation using fastutil's map implementations for storage.The following example creates a simple undirected weighted graph:
Graph<String, DefaultWeightedEdge> g = new FastutilMapGraph<>( SupplierUtil.createStringSupplier(), SupplierUtil.createDefaultWeightedEdgeSupplier(), DefaultGraphType.simple().asWeighted());
In case you have integer vertices, consider using the
FastutilMapIntVertexGraph
.- Author:
- Dimitrios Michail
- See Also:
FastutilMapIntVertexGraph
, Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.jgrapht.Graph
DEFAULT_EDGE_WEIGHT
-
-
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, 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 Detail
-
FastutilMapGraph
public FastutilMapGraph(Supplier<V> vertexSupplier, 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:
IllegalArgumentException
- if the graph type is not supported by this implementation
-
FastutilMapGraph
public FastutilMapGraph(Supplier<V> vertexSupplier, 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:
IllegalArgumentException
- if the graph type is not supported by this implementation
-
-