【Complex network modeling】——Threshold analysis of ER network and SF network

Table of contents

1. Introduce ER network and SF network

2. Calculate the network threshold

2.1 ER (Erdős-Rényi) network

2.2 SF (Scale-Free) network

3. Study the significance of network threshold 


1. Introduce ER network and SF network

In complex network theory, ER network (Erdős-Rényi network) and SF network (Scale-Free network) are two common network models, and they have great differences in structure and characteristics. Analyzing their thresholds involves different methods and concepts.

  1. ER network (Erdős-Rényi network) : ER network is a random graph model in which there are N nodes, and each pair of nodes is connected with probability p. Threshold analysis of ER networks usually involves a relatively simple threshold, that is, when the average degree (the average number of connections per node) exceeds a certain threshold, there will be a huge connected component in the network, that is, basically all nodes are can reach each other. This threshold is often referred to as the critical point, denoted p_c. When the average degree is less than the critical point, the connected components in the network are small, basically isolated small groups.

  2. SF network (Scale-Free network) : SF network is a special network whose degree distribution follows a power-law distribution, which means that a small number of nodes have very high degrees, while most nodes have low degrees. In SF networks, there is no clear threshold because their structure is not as simple as that of ER networks. However, some degree-related indicators can be used to analyze the characteristics of SF networks, such as the average shortest path length, clustering coefficient and degree-related hop count.

When analyzing the thresholds of these two types of networks, the main method is to study the connection patterns, node degree distribution, average path length, clustering coefficient and other characteristics in the network through mathematical models, simulations and calculations . In addition, some tools from graph theory and network science can be used, such as calculating the average degree, degree distribution, distance between nodes, etc. For the ER network, the main focus is on the critical point, while for the SF network, more attention is paid to the power law exponent of the degree distribution and the scale of the network.

The approach to threshold analysis depends on the network model and the specific network properties you are interested in. For ER networks, the focus is on finding critical points, while for SF networks, the degree distribution and degree-related properties are mainly concerned.

2. Calculate the network threshold

2.1 ER (Erdős-Rényi) network

networkxThe ER (Erdős-Rényi) network was generated and its threshold calculated using the library in Python .

import networkx as nx
import numpy as np

# 创建 ER 网络
def generate_er_network(num_nodes, edge_probability):
    er_graph = nx.erdos_renyi_graph(num_nodes, edge_probability)
    return er_graph

# 计算临界点阈值
def calculate_critical_threshold(num_nodes):
    return 1 / num_nodes

# 参数设置
num_nodes = 100  # 节点数量
edge_probability = 0.1  # 节点间连接概率

# 生成 ER 网络
er_network = generate_er_network(num_nodes, edge_probability)

# 计算临界点阈值
critical_threshold = calculate_critical_threshold(num_nodes)

# 打印临界点阈值和实际网络平均度
average_degree = np.mean(list(dict(er_network.degree()).values()))
print(f"临界点阈值: {critical_threshold}")
print(f"实际网络平均度: {average_degree}")

First, a function for generating an ER network is defined generate_er_network, and then an ER network is created using this function. Next, the critical point threshold calculate_critical_thresholdof the ER network was calculated as a function of the critical point threshold. Finally, by calculating the actual network average degree, print out the value of the critical point threshold and the actual network average degree.

 2.2 SF (Scale-Free) network

First, a function for generating an SF network is defined generate_sf_network, and then an SF network is created using this function. Then, networkxthe network diagram is drawn using the drawing function provided by and plt.show()displayed by calling .

import networkx as nx
import numpy as np
import matplotlib.pyplot as plt

# 创建 SF 网络
def generate_sf_network(num_nodes, average_degree):
    sf_graph = nx.barabasi_albert_graph(num_nodes, int(average_degree/2))
    return sf_graph

# 计算 SF 网络的阈值(在这里,SF 网络没有明确的阈值,这里只是一个示例)
def calculate_threshold(sf_network):
    # 这只是一个示例,SF 网络通常没有固定的阈值
    return np.mean(list(dict(sf_network.degree()).values()))

# 参数设置
num_nodes = 100  # 节点数量
average_degree = 6  # 平均度

# 生成 SF 网络
sf_network = generate_sf_network(num_nodes, average_degree)

# 绘制网络图
pos = nx.spring_layout(sf_network)  # 布局
nx.draw(sf_network, pos, with_labels=False, node_size=50)
plt.title("Scale-Free Network")
plt.show()

# 计算阈值(这里只是一个示例,实际上 SF 网络没有固定的阈值)
threshold = calculate_threshold(sf_network)
print(f"网络阈值: {threshold}")

 Network visualization:

Note: However, the SF network usually does not have a clear threshold, because its characteristic is that the degree distribution follows a power law distribution, and there is no critical point threshold. In the sample code, the function to calculate the threshold is just an example, in fact the SF network has no fixed threshold. If you want to perform a deeper analysis of SF networks, you may need to use other methods to explore its properties, such as power law exponents, etc. 

3. Study the significance of network threshold 

 In complex network theory, it is of great significance to study network threshold, which involves the relationship between network structure and function, and helps us to deeply understand the behavior and characteristics of the network. Here are some important implications of studying network thresholds:

  1. Phase transition behavior and critical phenomena understanding : Network thresholds are often related to the phase transition behavior and critical phenomena of the network. Phase transition refers to the transition of a network from one state to another, such as from disorder to order, and from decentralization to concentration. Threshold is the critical point at which this transformation occurs, and studying it helps to understand the dynamic behavior of networks such as self-organization, synchronization, and interaction.

  2. Network Resilience and Stability : Network thresholds affect the network's resilience and stability. Above the threshold, the network may rapidly transition from a decentralized state to a centralized state, resulting in a decrease in network resilience. Knowing the network's thresholds under different conditions helps predict how the network will behave under attacks, random failures, etc.

  3. Network Design and Optimization : Studying network thresholds can guide network design and optimization. Different network types have different threshold characteristics, and depending on the desired functionality, network parameters can be tuned to control the thresholds to achieve specific network performance and behavior.

  4. Propagation and Diffusion Process : Thresholds are also related to the dissemination and diffusion process of information, diseases, etc. in the network. In some propagation models, a node may be activated when its number of active neighbors reaches a certain threshold. Knowing the threshold helps predict the speed and scale of information dissemination.

  5. Social Network Analysis : In social networks, thresholds can explain why certain nodes are more likely to be influential nodes, even if their degrees are relatively low. This influence propagation is usually based on thresholds of node activations.

  6. Validation of network models : Network thresholds can be used to validate different network models. Comparing the thresholds generated by the model with those of the actual network can help us understand the applicability and accuracy of the model.

In conclusion, the study of network thresholds helps to reveal the intrinsic relationship between network structure and function, and provides a powerful tool for us to deeply understand the behavior of complex systems. It has a wide range of applications in many fields such as physics, sociology, ecology, and information dissemination.

 Regarding complex network modeling, I have written a lot before, and you can learn from it.

【Complex Network Modeling】—Common Drawing Software and Libraries_Graph Theory Drawing Software

[Complex network modeling] - Pytmnet for multi-layer network analysis and visualization

[Complex network modeling] - Python constructs ER network through average degree and random probability

[Complex Network Modeling] - Modeling and analysis of complex networks through graph neural networks

[Complex network modeling] - Python visualization of important node identification (PageRank algorithm)

[Complex Network Modeling] - Building a Graph Attention Network Model Based on Pytorch

Guess you like

Origin blog.csdn.net/lxwssjszsdnr_/article/details/132563831