Network topology and community detection
In this section, we are going to analyze some graph metrics to have a clear picture of the general structure of the graph. We will be using networkx
to compute most of the useful metrics we have seen in Chapter 1, Getting Started with Graphs. We will try to interpret the metrics to gain insights into the graph.
Network topology
A good starting point for our analysis is the extraction of simple graph metrics to have a general understanding of the main properties of bipartite and tripartite transaction graphs.
We start by looking at the distribution of the degree for both bipartite and tripartite graphs using the following code:
for G in [G_bu, G_tu]: Â Â plt.figure(figsize=(10,10)) Â Â degrees = pd.Series({k: v for k, v in nx.degree(G)}) Â Â degrees.plot.hist() Â Â plt.yscale("log")
By way of a result, we get the plot in the following diagram: