⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rndtopo1d.m

📁 这是一个超宽带的源码
💻 M
字号:
%% function [C,netsize,D,Rm,Rd] = rndtopo1d(n,d,vard)%% Generates random topology and traffic matrix. Nodes are Poisson% distributed with average n on a line of size n. Distance between a flow's% source and destination is normal, with mean d and variance vard.%% Returns:% C       - coordinates% netsize - size of the network% D       - src-dst pairs% Rm{1:N} - MER routing matrix, where each line contains the explicit MER route corresponding % 				to the entry in D% Rd{1:N} - DIR routing matrix%function [C,netsize,D,Rm,Rd] = rndtopo1d(n,d,vard)% Draw N on random, from Poisson distribution with average n.% Uniformly distribute N nodes on the segment of size n.N = max(poissrnd(n),3);				% if N = 2, there is an errorC(:,1) = sort(unifrnd(0,n,N,1));C(:,2) = zeros(N,1);netsize = [n,0];% lengths of flows are Gaussians with mean d and variance vard% however, we don't let length of a flow smaller than 1 and larger than N-1ddd = min(max(round(normrnd(d,vard,N,1)),ones(N,1)),N - 1 + zeros(N,1));D = mod((0:N-1)' + ddd,N)+1;% find MER routes and put in R (take minimum of lefthand and righthand routes)Rm = {};Rd = {};for i=1:N	Rd{i} = [i,D(i)];	if dist(i,D(i),C) > symdist(i,D(i),C,netsize)		Rm{i} = [max(i,D(i)):N,1:min(i,D(i))];	else		Rm{i} = [min(i,D(i)):max(i,D(i))];	endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -