# Source: # https://python.igraph.org/en/stable/tutorials/configuration.html#sphx-glr-tutorials-configuration-py import igraph as ig import matplotlib.pyplot as plt import random # Use the Matplotlib backend ig.config["plotting.backend"] = "matplotlib" ig.config["plotting.layout"] = "fruchterman_reingold" ig.config["plotting.palette"] = "rainbow" random.seed(1) g = ig.Graph.Barabasi(n=100, m=1) betweenness = g.betweenness() colors = [int(i * 200 / max(betweenness)) for i in betweenness] ig.plot(g, vertex_color=colors, vertex_size=15, edge_width=0.3) plt.show()