Class FastutilMapGraph<V,​E>

  • Type Parameters:
    V - the graph vertex type
    E - the graph edge type
    All Implemented Interfaces:
    java.io.Serializable, java.lang.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
    • Constructor Detail

      • FastutilMapGraph

        public FastutilMapGraph​(java.util.function.Supplier<V> vertexSupplier,
                                java.util.function.Supplier<E> edgeSupplier,
                                GraphType type,
                                boolean fastLookups)
        Construct a new graph.
        Parameters:
        vertexSupplier - the vertex supplier, can be null
        edgeSupplier - the edge supplier, can be null
        type - the graph type
        fastLookups - 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
      • FastutilMapGraph

        public FastutilMapGraph​(java.util.function.Supplier<V> 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 null
        edgeSupplier - the edge supplier, can be null
        type - the graph type
        Throws:
        java.lang.IllegalArgumentException - if the graph type is not supported by this implementation