Data structure equivalent to map ( in java ) for large datasets

directed-graph, java

Solution

`HashMap` is the correct data structure for a basic `Map`. The problem you are having is that the JVM is not being instructed to reserve enough space to keep the file contents in memory. Start the JVM with a `-Xmx` flag. For instance `-Xmx1G` parameter will allow it to use 1 Gigabyte of memory.

Problem

Is there an already implemented data structure that I can use in order to assign to an object (in my case an Edge), an integer? I am reading a graph from a file , 10 mil vertices , 60 mil edges and I assign to each edge , a cost , using a map ( costs.put(e,cost) ). I create the costs map in this way : ``` costs = new HashMap<Edge,Integer>(); ``` The exception that it gives is : ``` java.lang.OutOfMemoryError: Java heap space at java.util.HashMap.resize(Unknown Source) at java.util.HashMap.addEntry(Unknown Source) at java.util.HashMap.put(Unknown Source) ```

Original source

Related problems