public void generateMinutesVsFreq() throws IOException {

        minutesVsFreqFileWriter = new BufferedWriter(new FileWriter(minutesVsFreqFile));

        TreeMap<Long, Long> minutesVsFrequency = new TreeMap<Long, Long>();

        for( Long rootId : roots ) {

            Long minId = Long.MAX_VALUE, maxId = Long.MIN_VALUE;

            Queue<Long> q = new LinkedList<Long>();
            q.add(rootId);

            while ( !q.isEmpty() ) {

                Long id = q.poll();

                if( id < minId )
                    minId = id;

                if( id > maxId )
                    maxId = id;

                if( adjacencyList.containsKey(id)) {
                    for (Long childId : adjacencyList.get(id)) {
                        q.add(childId);
                    }
                }
            }

            long minutes = (tweetMap.get(maxId).getTweetTimestamp().getTime() - tweetMap.get(minId).getTweetTimestamp().getTime())/60000;

            if( !minutesVsFrequency.containsKey(minutes) )
                minutesVsFrequency.put(minutes, 1L);
            else {
                long freq = minutesVsFrequency.get(minutes);
                minutesVsFrequency.put(minutes, freq + 1);
            }

        }

        for( Long numUsers: minutesVsFrequency.keySet() ) {
            minutesVsFreqFileWriter.write(numUsers + "-" + minutesVsFrequency.get(numUsers) + '\n');
        }

        minutesVsFreqFileWriter.close();


    }