## 作为联合概率分布的度相关

$P(k_1, k_2)$ 表示度为$k_1$和$k_2$ 的两个节点连接在一起的概率。 如果没有度相关: $P(k_1, k_2) \sim k_1 P(k_1) k_2 P(k_2)$。

## 密度守恒定律

Density conservation law

$\int P(k_1, k_2) d k_2 = k_1 P(k_1)$

$\int P(k_1, k_2) d k_2 = k_1 P(k_1) \sim k_1^{-(\gamma -1) }$

## 硬猜$P(k_1, k_2)$

The statistical similarity of the corresponding plots suggests the invariance of $P(k_1, k_2)$. Accordingly, this suggests that the $k_1$ and $k_2$ dependence can be separated, and the behavior of the tail of the joint degree distribution is

$P(k_1, k_2) \sim k_1^{-(\gamma -1 )} k_2^{-\epsilon}$ (1)

for completely random networks:

$P(k_1, k_2) \sim k_1 P(k_1) k_2 P(k_2) \sim k_1^{1-\gamma} k_2^{1-\gamma}$ (2)

Using Eq. (1), we can see that:

• For low-degree nodes ($k_1 > k_2$), integrating over $k_2$, we retrieve the $k^{1-\gamma}$ dependence.
• For the case of hubs, where integration is over $k_1$, the dependence on the degree is $k^{-\epsilon}$

## $E_b(k)$

$E_b(k) \equiv \frac{\int_{bk}^{\infty} P(k | k’) dk’}{ \int_{bk}^{\infty} P( k’) dk’ }$

• 分子是两节点度为k和大于bk的链接比例；
• 分母是度大于bk的节点的比例

• 推导1：$P(k | k’) = \frac{P(k, k’) }{\int P(k, k’) dk} = \frac{k^{-(\gamma-1)} k’^{-\epsilon}}{k’^{1-\gamma}} = k^{-(\gamma -1)} k’^{-(1+\epsilon – \gamma)}$
• 推导2：$P(k | k’) = \frac{P(k, k’) }{P(k’)} = \frac{k^{-(\gamma-1)} k’^{-\epsilon}}{k’^{-\gamma}} = k^{-(\gamma -1)} k’^{-\epsilon + \gamma}$

## 计算$E_b(k)$

– 使得其中的 k’>k – 选择 b = 3
– 计算： ** – 计算k’ > 3k, k = k的链接数量$N_{kk’}$ **
– 计算$P(k, k’) = \frac{N_{kk’}}{Number\;of\;edges}$ **
– 对于每一个节点, 计算整个网络节点的度大于3k的比例, $P(k’)$和$k’ P(k’)$ **
– 计算$p1 = \sum \frac{P(k, k’)}{k’ P(k’)}$和$P2 = \sum P(k’)$。 **
– 计算 p1/p2

%matplotlib inline
import networkx as nx
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from collections import defaultdict

def ebkk(g, b):
edge_dict = defaultdict(lambda: defaultdict(int))
degree_dict = defaultdict(int)
edge_degree = [sorted(g.degree(e).values()) for e in g.edges()]
for e in edge_degree:
edge_dict[e[0]][e[-1]] +=1
for i in g.degree().values():
degree_dict[i] +=1
edge_number = g.number_of_edges()
node_number = g.number_of_nodes()
ebks, ks = [], []
for k1 in edge_dict:
p1, p2 = 0, 0
for k2 in edge_dict[k1]:
if k2 &gt;= b*k1:
pkk = float(edge_dict[k1][k2])/edge_number
pk2 = float(degree_dict[k2])/node_number
k2pk2 = k2*pk2
p1 += pkk/k2pk2
p2 += pk2
if p2 &gt; 0:
ebks.append(p1/p2)
ks.append(k1)
return ebks, ks

# http://snap.stanford.edu/data/ca-CondMat.html
ca = nx.Graph()
with open ('/Users/chengjun/bigdata/ca-CondMat.txt') as f:
for line in f:
if line[0] != '#':
x, y = line.strip().split('\t')
ca.add_edge(x,y)
nx.info(ca)

ebk, k = ebkk(ca, b=3)

plt.plot(k,ebk,'r^')
plt.xlabel(r'$k$', fontsize = 16)
plt.ylabel(r'$E_b(k)$', fontsize = 16)
plt.xscale('log')
plt.yscale('log')
plt.show()


## Reference

Lazaros K. Gallos, Chaoming Song, Hernán A Makse, 2008. Scaling of Degree Correlations and Its Influence on Diffusion in Scale-Free Networks. Physical Review Letters 100(24):248701 Impact Factor: 7.51 DOI: 10.3731/topologica.2.020

Updated:

Show Comments