ba - create one normal BA scale-free network model
Calling Sequence
[a b]=ba(M0,M,T)
Parameters

M0: integer
M: integer
T: integer
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 

Description
ba creates one normal BA scale-free network with exponent r=3. M0 is the initial nodes which compose an original complete graph. M is the number of link added into the  
graph every time step (M <= M0), T is the total evolutional time step. Note the network size is M0+T here. 

Example
[a b]=ba(6,4,9994);
g=make_graph('ba',0,10000,a,b);

er ws bbv sba 


/////////////////////////////////////////////////
er - create the ER random graph 
Calling Sequence
[a b]=er(N,K)

Parameters
N: integer
K: integer
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 

Description
er creates one ER random graph. N is the network size, K is the average degree of ER graph. 

Example
[a b]=er(1000,2);
g=make_graph('er',0,1000,a,b);

ba ws bbv sba

////////////////////////////////////////////////
ws - create the WS small world model 
Calling sequence
[a b]=ws(N,K,P)

Parameters
N: integer
K: integer
P: a real number
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 

Description 
ws creates the WS small-world network. N is the network size, K is the average degree, P is the rewired probability. Note the K must is even here.

Example
[a b]=ws(10000,3,0.5);
g=make_graph('ws',0,10000,a,b); 

er ba bbv sba

///////////////////////////////////////////////////
bbv - create the BBC weighted network model
Calling sequence 
[a b s w]=bbv(M0,M,T,W0,Delta)

Parameter:
M0: integer
M: integer
W0: a real number
Delta: a real number
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 
s: row vector of the weight S of nodes of the graph (its size is the number of nodes of the graph)
w: row vector of the weight of edges of the graph (its size is the number of edges of the graph)

Description
bbv creates the famous BBV model with tunable exponent  2<r<=3. M0 is the number of the initial nodes which compose an original complete graph. M is the number of link added into the
model every time step (M<=M0), T is the evolution time step. The W0 is the initial weight of edge added the network at first. Delta is the additional weight when one nodes  
is linked by a new edge.

Example
[a b s w]=bbv(6,4,9994,1,1);

er ws ba sba 
////////////////////////////////////////////////
sba - create the derivational BA model with arbitrary attractiveness, fitness and 
nonlinear attachment probability. 

Calling sequence
[a b]=sba(M0,M,T,assort,k0,exp)

Parameter:
M0:integer
M: integer
T: integer
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 

Description
Recently scholars purposed several new parameters such as
attractiveness, fitness and nonlinear attachment probability in order to simulate the different statistic 
results of networks. People could define the matrix assort, k0, with different
rules, generate the Dorogovtsev -Mendes-Samukhin (DMS) model, Krapivsky model, Bianconi-Barabasi (BB) model.

Example
assort=ones(1,10000);
k0=zeros(1,10000);
[a b]=sba(6,4,9994,assort,k0,2);

er ws ba bbv




////////////////////////////////////////////////
assc - calculate the assortative mixing parameter in Networks purposed by M.E.J. Newman

Calling sequence
r=assc (a,b,n)

Parameter:
a:row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b:row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 
n:interger

Description
A network is said to show
assortative mixing if the nodes in the network that have many
connections tend to be connected to other nodes with many
connections, and show disassortative mixing reversely. Here when
r>0, network is assortative, when r<0, network is disassortative.

Example

[a b]=ba(6,4,9994);
r=assc(a,b,10000)


////////////////////////////////////////////////
tran - translate the head and tail of graph into the matrix G structure like the adjacency link
 
Calling sequence
G=tran(a,b,N);

Parameter:
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 
N: the node number of the model
G: the translated matrix. G[i][0] represents the degree of node i. G[i][1],G[i][2]... represent its neighbors.

Description:
tran creates the matrix structure link adjacency link for one graph. It is a useful function for the complex network because it is easy to write the program in scilab.

Example
G=tran(a,b,N);

bet cluster 


////////////////////////////////////////////////
bet - calculate the betweenness centrality of nodes in graph
Calling Sequence
   c=bet(tran);

Parameters
tran: the matrix translated by the function Tran
c: row vector of the betweenness of nodes of the graph (its size is the number of nodes of the graph)

Description
bet calculates the betweenness using the faster algorithm, tran is one translated structure of a graph like the adjacency link. 

Example
[a b]=ba(6,4,9994);
tmp=tran(a,b,10000);
betweenss=bet(tmp);

tran

//////////////////////////////////////////////////

scidecom - calculate the community structure of the network

Calling Sequence
[c d q w]=scidecom(a,b)

Parameters
c: row vector of the numbers of the head nodes of the graph 
d: row vector of the numbers of the tail nodes of the graph 
q: the community structure parameter Q purposed by M.E.J. Newman
w: the community distribution when the Q is maximum.

Description:
In order to analyze the community structure - groups of vertices within which connections 
are dense but between which they are sparser, Aaron Clauset, M.E.J. Newman and Cristopher Moore present a hierarchical agglomeration algorithm for detecting the community structure. scidecom is only an interface function which calls the program 'fastcommunity_mh' (under GPL) and covert the result into matrix variables.

Example
[a b]=ba(6,4,9994);
[c d q w]=scidecom(a,b)

 


/////////////////////////////////////////////////
sis - the susceptible-infected-susceptible (SIS) model.

Calling Sequence
[inf infname]=sis(a,b,N,T,N0,P)

Parameters:
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph) 
N: the node number of the model
T: the epidemic time step
N0: the initial infected node
P: the infected probability
inf: row vector of the infected fraction of the graph(its size is the time step)
infname: row vector of the infected node name

Description
sis calculates the infected fraction every time step for the SIS epidemic process. 

Example
[a b]=ba(6,4,9994);
[inf infname]=sis(a,b,10000,1000,1000,1);
t=[1:1000];
plot2d(t,inf(t));

sirs

///////////////////////////////////////////////////
sirs - the susceptible-infected-rescued-susceptible (SIRS) model

Calling Sequence
inf=sirs(a,b,N,T,N0,TI,TR,P)

Parameters:
a: row vector of the numbers of the tail nodes of the graph (its size is the number of edges of the graph) 
b: row vector of the numbers of the head nodes of the graph (its size is the number of edges of the graph)
N: the node number of the SIRS model
T: the epidemic time step
N0: the initial infected node
TI: the infected state holding time, then the node will change its status to refractory state
TR: the refractory state holding time, then the node will change its status to suspectible state
P: the infected probability
inf: row vector of the infected fraction of the graph(its size is the time step)

Description
sirs calculates the infected fraction every time step for the SIRS epidemic process. Note when the TR is large enough, SIRS is the SIR epidemic process. 

Example
[a b]=ba(6,4,9994);
inf=sirs(a,b,10000,1000,1000,5,3,1);
t=[1:1000];
plot2d(t,inf(t));

sis


//////////////////////////////////////////////////////
cluster  -  calculate the cluster coefficient

Calling Sequence
[averc c]=cluster(t)

Parameters:
i: integer
g: graph list
averc:a real number
c: row vector of the cluster coefficient of nodes of the graph (its size is the number of nodes of the graph)
t:matrix converted by tran function

Description
cluster return the cluster coefficient of the given node and the average clustering coefficient of the whole graph. 

Example
[a b]=ba(6,4,9994);
t=tran(a,b,10000);
[averc c]=cluster_measure(1,g);

tran
//////////////////////////////////////////////////////////
ws_c - Calculate the expected cluster coefficient for WS small world

Calling Sequence
cb=ws_c(K,P)

Parameters:
K:a real number
P:a real number
cb:a real number

Description
Calculate the expected cluster coefficient of the given WS small world. K is the average degree of the WS model, P is the probability of rewiring edges. Note K is even  
here.

Example
cb=ws_c(4,0.1)

ba_c

/////////////////////////////////////////////////////////////
ba_c _ Calculate the expected cluster coefficient for BA model

Calling Sequence
cb=ba_c(M,T)

Parameters:
M: integer
T: integer

Description
Calculate the expected cluster coefficient of the given BA model. M is the number of link added into the graph every time step, T is the total evolutional time step.

Example
cb=ba_c(4,10000)


ws_c

//////////////////////////////////////////////////////////////
nw_c - Calculate the expected cluster coefficient for NW small world

Calling Sequence
cb=nw_c(K,P)

Parameters:
K:a real number
P:a real number
cb:a real number

Desciption
Calculate the expected cluster coefficient of the given WS small world. K is the average degree of the WS model, P is the probability of adding edges. Note K is even here.

Example
cb=nw_c(4,0.1)
//////////////////////////////////////////////////////////////

ws_l - Calculate the expected average distance of the WS model

Calling Sequence
dis=ws_l(K,P,N)

Parameters:
K:a real number
P:a real number
N:integer

Description
Calculate the expected average distance of the WS model. K is the average degree of the WS model, P is the probability of rewiring edges. Note K is even here.

Example
dis=ws_l(4,0.5,10000)

ba_l

////////////////////////////////////////////////////////////

ba_l - Calculate the expected average distance of the BA model

Calling Sequence
dis=ba_l(N)

Parameters:
N: integer
dis:a real number

Description
Calculate the expected average distance of the BA model. N is the total node number of BA model. Note here dis is a parameter to measure the distance of BA models. The  
actual distance equals C*dis, C is constant here.

ws_l

//////////////////////////////////////////////////////////////
home_et - calculate the expected epidemic transition of homogeneous models such as WS and ER model.


Calling Sequence
et=homo_et(g)

Parameter:
g:graph list
et:a real number

Description
Calculate the expected epidemic transition of homogeneous models. 

heter_et
////////////////////////////////////////////////////////////////

heter_et - calculate the expected epidemic transition of heterogeneous model such as BA and
BBV model, etc.

Calling Sequence
et=heter_et(g)

Parameter:
g: graph list
et: a real number

Description
Calculate the expected epidemic transition of heterogeneous network models.

homo_et(g)
///////////////////////////////////////////////////////////////////////

attack - Simulate attack behaviors to the network model

Calling Sequence
g1=attack(g,t,flag)

Parameter:
g:graph list
t: integer
flag: integer (0,1,2)

Description
Simulate attack behaviors to the network model. g is the initial model, t is the attack time, flag is the scale factor which represents different attack strategies. 
flag=0: attack one node randomly
flag=1: attack one link randomly
flag=2: attack one node with the maximum degree in every time step.

Example
[a b]=ba(6,4,9994);
g=make_graph('ba',0,10000,a,b);
t=tran(g('head'),g('tail'),g('node_number'));
disp(eff(t));
g=attack(g,10,2);
t=tran(g('head'),g('tail'),g('node_number'));
disp(eff(t));

eff
////////////////////////////////////////////////////////////////////////

eff- Calculate the efficiency of the network

Calling Sequence
e=eff(t)

Parameter:
t:the matrix converted by tran function
e:a real number

Description
Calculate the efficiency of the network. The function choose the harmonic mean of geodesic lengths to represent the so-called efficiency of graph.


attack
////////////////////////////////////////////////////////////////////////
draw_graph - Display the graph of the network using a hiberarchy method

Calling Sequence
draw_graph(g,scale)

Parameter:
g:graph list
scale:real value, scale factor 

Description
Display the graph of the network without giving the g('node_x') and g('node_y'). The function will obtain the g('node_x') and g('node_y') automatically.

Example
[a b]=ba(6,4,9994);
g=make_graph('ab',0,10000,a,b);
draw_graph(g,1);


draw_degree
/////////////////////////////////////////////////////////////////////
draw_degree - Display the degree distribution of the network

Calling Sequence
draw_de gree(g,flag)

Parameter:
g: graph list
flag: integer

Description
draw_degree is used to display the degree distribution of the
network, here g is the scilab G list, flag=0,1,2 represents the
nn, ln, ll scale of the axes. here 'l' stands for logarithmic
scale and graduation and 'n' for normal scale.

Example
[a b]=ba(6,4,9994);
g=make_graph('ab',0,10000,a,b);
draw_degree(g,2);

draw_graph
























