V
- the graph vertex typeE
- the graph edge typepublic class FastutilMapGraph<V,E> extends AbstractBaseGraph<V,E>
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
.
FastutilMapIntVertexGraph
,
Serialized FormDEFAULT_EDGE_WEIGHT
Constructor and Description |
---|
FastutilMapGraph(Supplier<V> vertexSupplier,
Supplier<E> edgeSupplier,
GraphType type)
Construct a new graph.
|
FastutilMapGraph(Supplier<V> vertexSupplier,
Supplier<E> edgeSupplier,
GraphType type,
boolean fastLookups)
Construct a new graph.
|
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
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSets
finalize, getClass, notify, notifyAll, wait, wait, wait
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices, setEdgeWeight
public FastutilMapGraph(Supplier<V> vertexSupplier, Supplier<E> edgeSupplier, GraphType type, boolean fastLookups)
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)IllegalArgumentException
- if the graph type is not supported by this implementationpublic FastutilMapGraph(Supplier<V> vertexSupplier, Supplier<E> edgeSupplier, GraphType type)
By default we index vertex pairs to allow (expected) constant time edge lookups.
vertexSupplier
- the vertex supplier, can be nulledgeSupplier
- the edge supplier, can be nulltype
- the graph typeIllegalArgumentException
- if the graph type is not supported by this implementationCopyright © 2019. All rights reserved.