Currently working in Eclipse on a problem. Data stucture weightedQuickUnionFind
What I have:
-a list of data in a separate .txt file which contains ID's of users. example:
0 5
0 2
1 3
1 2
2 5
3 7
What this is basically saying is that users of ID 0 is connected in a social network with users of an ID of 5 and so on. if 0 is connected to 2, and 1 is connected to 2, then 0 is connected to 2. Hope that's clear. Anyway, with this list, I have written a Main class and a WeightedUnionFind Class. In my main class I have shelled out several methods that will help me to answer the questions:
- How many people are connected to each individual, (ie. how many people are connected to 0), and how many have no connections?
- How many groups of ID's are connected and what is the largest group?
I don't want to flood this with question after question, so I'm just looking for a start off point.
Like I said I've only shelled out the methods so far, and just need a starting point to implement these methods on the .txt file.
/**
*numberOfIndividuals() method Finds # of distinct individual in data
*ie. how many users are there?
*/
public static int numberOfIndividuals()
{
return -1;
// not implemented yet
}
/**
* Get the number of distinctly connected groups of individuals.
*
*/
public static int numberOfGroups()
{
return -1;
// not implemented yet
}
I have written a separate class called
public class WeightedQuickUnionUF {
//which I incorporate the methods find, count, union etc.
}
Hope this was clear.