English: The evolution of a network by the Barabasi–Albert model. In every step, one new node appears, and in this case there is two new edges from the new node to the old ones.
Magyar: Egy hálózat fejlődése a Barabási–Albert modell szerint. Minden lépésben egy új csúcs jelenik meg, és ebben a változatban minden új csúcsból két él mutat a régi csúcsokhoz.
The code is (using the python-networkx and python-matplotlib packages on Ubuntu GNU/Linux distribution):
#! /usr/bin/python
# coding: utf-8
import networkx
#import pylab
from pylab import pi, cos, sin, linspace, array
import matplotlib.pyplot as plt
import os
node_number = 20
initial_nodes = 2
animation = False
animation = True
G=networkx.barabasi_albert_graph(node_number, initial_nodes)
# pos=networkx.graphviz_layout(G, prog="dot")
type="shell4"
pos=networkx.shell_layout(G)
#pos=networkx.graphviz_layout(G,prog='twopi',args=)
print pos
dir=os.path.join("images", type)
if not os.path.isdir(dir):
os.mkdir(dir)
Ge = networkx.empty_graph(node_number)
#networkx.draw(GG,pos, node_color="w")
for i in range(initial_nodes,node_number):
nodes = range(i+1)
GG = G.subgraph(nodes)
plt.figure(figsize=(8,8))
networkx.draw(GG,pos, node_color="w", alpha=0.5, node_color="blue", node_size=20, with_labels=False, hold=False)
#networkx.draw(Ge,pos, node_color="w", alpha=0.5, node_color="blue", node_size=20, with_labels=False, hold=True)
#nx.draw(G,pos,node_size=20,alpha=0.5,node_color="blue", with_labels=False)
xmax=max(xx for xx,yy in pos.values())
xmin=min(xx for xx,yy in pos.values() + [(0,0)])
ymax=max(yy for xx,yy in pos.values())
ymin=min(yy for xx,yy in pos.values() + [(0,0)])
dx = xmax - xmin
ddx=0.1*dx
dy = ymax - ymin
ddy=0.1*dy
plt.xlim(xmin-ddx,xmax+ddx)
plt.ylim(ymin-ddy,ymax+ddy)
plt.savefig("%s/barabasi_%s%02d.png" % (dir, type, i))
if animation:
input = os.path.join(dir, "*.png")
output = os.path.join(dir, "barabasi_albert.gif")
os.system("convert -delay 100 -loop 0 %s %s" % (input, output))
(If someone knows how to eliminate the frame around the network, write to me, please.)
اجازهنامه
من، صاحب حقوق قانونی این اثر، به این وسیله این اثر را تحث اجازهنامههای ذیل منتشر میکنم:
اجازهٔ کپی، پخش و/یا تغییر این سند تحت شرایط مجوز مستندات آزاد گنو، نسخهٔ ۱٫۲ یا هر نسخهٔ بعدتری که توسط بنیاد نرمافزار آزاد منتشر شده؛ بدون بخشهای ناوردا (نامتغیر)، متون روی جلد، و متون پشت جلد، اعطا میشود. یک کپی از مجوز در بخشی تحت عنوان مجوز مستندات آزاد گنو ضمیمه شده است.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue
برای به اشتراک گذاشتن – برای کپی، توزیع و انتقال اثر
تلفیق کردن – برای انطباق اثر
تحت شرایط زیر:
انتساب – شما باید اعتبار مربوطه را به دست آورید، پیوندی به مجوز ارائه دهید و نشان دهید که آیا تغییرات ایجاد شدهاند یا خیر. شما ممکن است این کار را به هر روش منطقی انجام دهید، اما نه به هر شیوهای که پیشنهاد میکند که مجوزدهنده از شما یا استفادهتان حمایت کند.
انتشار مشابه – اگر این اثر را تلفیق یا تبدیل میکنید، یا بر پایه آن اثری دیگر خلق میکنید، میبایست مشارکتهای خود را تحت مجوز یکسان یا مشابه با ا اصل آن توزیع کنید.
{{Information |Description={{en|1=The evolution of a graph by the Barabasi Albert model. In every step, one new node appears, and in this case there is two new edges from the new node to the old ones. }} {{hu|1=Egy gráf fejlődése a Barabási-Albert mod