I have data in the below form, which makes up a bipartite network.
A1 - B1
A2 - B2
A2 - B1
A3 - B1
A4 - B2
A5 - B3
A6 - B3
A7 - B3
A7 - B3
A8 - B4
A9 - B3
What I would like to do is write something (ideally in python or C) or use an existing library to identify individual communities within the data. For instance
A1,A2,A3,A4 are all part of the same community because they connect to B1,B2 similarly A5,A6,A7,A8,A9 all connected to B3 and B4.
I am a bit confused having read lots various articles about network flow and graphs as to exactly where my problem sits. Is this just a form of Breadth-first search or is there a more efficient means of doing this?
Thanks