I have a csv file and its format:
user1;user2;0.3
user1;user7;0.8
user2;user7;0.3
.....
user78;user36;0.1
Each line has three elements : user_1_ID, user_2_ID, and similar value. I want to write an algorithm to find the mutual relationships among a certain number of users. For example, as we can see, the user1 has the relationship with the user2(user1;user2;0.3), with the user7 (user1;user7;0.8), and the user2 has the relationship with the user7(user2;user7;0.3). So if we want to find which THREE users have the mutual relationships, we should find user1-user2-user7. THREE is just one example, and it may be FIVE, EIGHT as long as this relationship exists. May someone gives me some ideas about how to write this algorithm. Any data structure is acceptable and prefer to implement it in java.