generate_internet_as#
- graph_tool.generation.generate_internet_as(N)[git][source]#
Generate a random graph of the Internet at the level of autonomous systems.
- Parameters:
- N
int Number of vertices.
- N
- Returns:
- g
Graph The generated undirected graph.
- vtype
VertexPropertyMap Kind of every autonomous system:
"T"(tier-1),"M"(mid-level),"CP"(content provider), or"C"(customer).- etype
EdgePropertyMap Kind of every edge:
"transit"(from the customer, its source, to the provider, its target) or"peer".
- g
See also
price_networkPrice’s and Barabási–Albert’s preferential attachment
generate_extended_baPreferential attachment with edge rewiring
generate_holme_kimPreferential attachment with tunable clustering
Notes
In the model of Elmokashfi, Kvalbein, and Dovrolis [elmokashfi-scalability-2010], there are five regions, and the graph starts with \(n_T = \lfloor 4 + 2U\rceil\) tier-1 vertices (for \(U\) uniform in \([0, 1)\)), which form a clique of peering edges and are present in all regions. The \(\lfloor 0.15N\rceil\) mid-level vertices, the \(\lfloor 0.05N\rceil\) content providers, and the remaining customers are then added in this order. Every new vertex is placed in two distinct random regions with probability 0.2 (mid-level), 0.05 (content providers), or 0 (customers), and otherwise in one, and attaches transit edges to a random number of distinct providers, with mean \(d_M = 2 + 2.5N/10^4\), \(d_{CP} = 2 + 1.5N/10^4\) or \(d_C = 1 + 5N/10^5\), respectively. Each provider is chosen among the tier-1 vertices of the regions of the new vertex with probability \(t_M = t_{CP} = 0.375\) or \(t_C = 0.125\), and otherwise among the mid-level vertices of these regions (or among the other kind, if one of them has no candidates left), with probability proportional to its current degree. Finally, every mid-level vertex attaches a random number of peering edges, with mean \(1 + 2N/10^4\), to other mid-level vertices that are not already adjacent and not among its direct or indirect customers and providers, chosen with probability proportional to their numbers of peering edges (or uniformly, if these are all zero); every content provider attaches peering edges to uniformly chosen mid-level vertices of its regions (mean \(0.2 + 2N/10^4\)) and then to other content providers of its regions (mean \(0.05 + 2N/10^5\)), excluding its providers and its neighbors. The random numbers of edges with mean \(m\) take values approximately uniform in \([a, 2m - a]\), with \(a = 1\) for the transit edges and \(a = 0\) for the peering edges. The algorithm runs in time \(O(N^2)\).
References
[elmokashfi-scalability-2010]Ahmed Elmokashfi, Amund Kvalbein and Constantine Dovrolis, “On the scalability of BGP: The role of topology growth”, IEEE Journal on Selected Areas in Communications 28, 1250-1261 (2010), DOI: 10.1109/JSAC.2010.101003 [sci-hub, @tor]
Examples
>>> g, vtype, etype = gt.generate_internet_as(1000) >>> print(g.num_vertices(), g.num_edges()) 1000 1521
A smaller instance is drawn as follows, with the vertex colors indicating the kinds of vertices:
>>> g, vtype, etype = gt.generate_internet_as(200) >>> kind = g.new_vp("int", vals=[["T", "M", "CP", "C"].index(t) ... for t in vtype]) >>> cmap = matplotlib.colors.ListedColormap( ... ["#9bbedc", "#f28c8e", "#a6d7a4", "#cba6d1"]) >>> gt.graph_draw(g, pos=gt.sfdp_layout(g), vertex_fill_color=kind, ... vcmap=cmap, output="generate_internet_as-small.pdf") <...>
Internet topology graph with \(N=200\) autonomous systems. The vertex colors indicate the tier-1 vertices (blue), the mid-level vertices (red), the content providers (green), and the customers (purple).#