Class FastutilMapIntVertexGraph<E>
java.lang.Object
org.jgrapht.graph.AbstractGraph<Integer,E>
org.jgrapht.graph.AbstractBaseGraph<Integer,E>
org.jgrapht.opt.graph.fastutil.FastutilMapIntVertexGraph<E>
- Type Parameters:
E- the graph edge type
- All Implemented Interfaces:
Serializable, Cloneable, Graph<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());
- See Also:
-
Field Summary
FieldsFields inherited from interface Graph
DEFAULT_EDGE_WEIGHT -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class 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, vertexSetMethods inherited from class AbstractGraph
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSetsMethods inherited from interface Graph
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices, setEdgeWeight
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
FastutilMapIntVertexGraph
public FastutilMapIntVertexGraph(Supplier<Integer> 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
-
FastutilMapIntVertexGraph
public FastutilMapIntVertexGraph(Supplier<Integer> 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
-