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.
Campus network
A hundred switches, servers and computers in ten buildings of a university campus, A to J. Each id is a building letter and a number, so D7 is number 7 in building D. A is the data center, where the core switches A1 and A2 link to the main switch of every other building, always number 1. The larger buildings have more switches between the main switch and the computers, and two pairs of neighboring buildings also have a direct link.
An undirected graph with 100 vertices and 114 edges.
Which groups of devices are all linked to each other, where no other device is linked to 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.