%
%This function is run by  dd
%
%  Last change:  10/2/2005 - Florian Knorn

function P = sw_reg_model(param,k)

global K;

p = param(1);
scaler = param(2);

P = [];

for i = 1:length(k)
	P(i) = 0;
	for j = 0:min([k(i)-K/2 K/2]) % sum_n=0^f(k,K) , ref. (77) Albert,Barabasi-Paper
		P(i) = P(i) + binomial(K/2,j) * (1-p)^j * p^(K/2-j) * ...
			(p*K/2)^(k(i)-K/2-j)/factorial(k(i)-K/2-j) * exp(-p*K/2);
	end
end
P = P*scaler;