A complete graph is a graph in which every pair of nodes is connected by a unique connection. A clique is a subgraph that is complete. This is equivalent to the general concept of cliques in which every person knows all the other people. The maximum clique is the clique with the most nodes. The clique number is the number of nodes in the maximum clique. Unfortunately finding the clique number takes a long time, so we will not use the complete Facebook SPAN data.
The code is in the clique_number.py
file in this book's code bundle:
The imports are as follows:
import networkx as nx import dautil as dl
Load the Facebook SPAN data into a NetworkX graph:
fb_file = dl.data.SPANFB().load() G = nx.read_edgelist(fb_file, create_using=nx.Graph(), nodetype=int)
Determine the clique number for a subgraph:
print('Graph Clique Number',...