Maximal cliques
Finds every group of vertices that are all adjacent to each other and can't take one more vertex.
Time complexity O(3^(V/3)), gograph function partition.MaximalCliques.
Karate club
The 34 members of a university karate club, numbered 1 to 34 as in the study. Each edge joins two members who also spent time together outside the club's classes and meetings. A dispute between the instructor (1) and an officer (34) split the club in two, and most members sit near the side they joined.
An undirected graph with 34 vertices and 78 edges.
Which groups of members all spent time with each other outside the club, where no other member spent time with all of them?
Use it in Go
for _, clique := range partition.MaximalCliques(g) {
var names []string
for _, v := range clique {
names = append(names, v.Label())
}
fmt.Println(strings.Join(names, ", "))
}
Example graphs
- Friend groups, 12 vertices and 21 edges
- Office network, 13 vertices and 16 edges
- Karate club, 34 vertices and 78 edges
- Campus network, 100 vertices and 114 edges
More in Partitioning
- Girvan-Newman: Splits an undirected graph into k communities by removing, one at a time, the edge that the most shortest paths cross.
- Randomized k-cut: Splits an undirected graph into k groups by merging the ends of random edges until k groups are left, and cuts the edges between them.