
Random Generation of bi-directional Graphs in Omnet, Omar Usman
Published in Khyber.ORG on Wednesday, July 4 2012 (http://www.khyber.org)

ډېروخلکوته پته ده چې دملي سرود دورلېږلـوپه بهيراو تـرڅ موږهم يوښکولى شېرورلېږلى وو،شېرځکه ورته وايم چې له شاربلوڅخه اخيستل شوى نــوم دى له بل چاڅخه مــونــه پــه لشکرکشۍراوړى دى اونه په خيرات کې راکول شوى دى.
. . . نور
The 42-year old Durrani belongs to Maulana Fazlur Rahman's JUI, which is the largest component of the MMA. He was elected MPA from the southern Bannu district in the October 10, 2002 general elections.
. . . Read More
د پښتو په شاعرانو کښ عبد الحميد ښه شاعر تير شوي دې. وائي چه د عبد الرحمان بابا دعا رنګ کړې وۀ. څکه چه دې د هغه په آخره عمر کښ وۀ. او ړومبې کښ چه د ده عزلي د عبدالرحمان بابا تر غوږ شوې نو دې ئي را وغوښته او چه د ده عاجزي او خاکساري ئې وليده نو ډير ئي خوښ شه او ډيره ډيره دعا يې ورته وکړه او خدائي ته ئې سوال وکړه چه د ده شعرونه دې په هر چا . . . نور
Ali, who is one among the most popular and highly regarded singers of the frontier province of Pakistan, is currently on a two week tour to Doha. Through his deep-throated voice and special style of singing, he has received
. . . Read More
Gurbaz was the son of the third Mubarak. His dynasty is resided in the north of Miran Shah on Pak-Afghan bordernear Khost; while some of them is living between the area of Khajori & Shinki on Bannu - Miran Shah road. These dynasty are . . . Read More
Publishing Date: Wednesday, July 4 2012
The Omnet usman.html manual has code for generation of random topologies. The type of network generated can contain uni-directional, or bi-directional edges. Usually, people working with networks require generation of bi-directional graphs only. What you will see here is a small hack to the Omnet Engine, which can enable you to do that. (Note: I am not an expert on Omnet so most probably there is another simpler way of doing this. If you do, please leave a comment).
The files you need to modify are:
You need to create a new function (runiform). What this does is that it retains the random number generated from a previous call to uniform(). The random number is generated every 2-calls.
double runiform(int rng) {
static int r = 0;
static double l = 0;
if(r%2 == 0) l = uniform(0,1);
r++;
return l;
}Just one line to be modified here:
SIM_API double runiform(int rng=0);
The current usman.html manual (July 4, 2012) shows a different way of doing this. The code in the manual is not consistent with what I found in the source (4.2.2). You need to add the following code to where the other continuous random variate generation code is present.
DEF(nedf_runiform,
"quantity runiform(int rng?)",
"random/continuous",
"Retains the value generated from a previous call to uniform()",
{
int rng = argc==2 ? (int)argv[1] : 0;
return cNEDValue(runiform(rng), argv[0].getUnit());
})
If you have already compiled omnet once, you can simply run make and compile the engine again. When complete, fire up your editor and open your .NED file. You can now generate bi-directional graphs using the following code from the manual (which is adopted to this hack):
module RandomGraph {
parameters:
int count;
double connectedness; // 0.0 submodules:
node[count]: Node {
gates:
in[count];
out[count];
}
connections allowunconnected:
for i=0..count-1, for j=0..count-1 {
node[i].out[j] --> node[j].in[i]
if i<j && runiform() > connectedness;
node[j].out[i] --> node[i].in[j]
if i<j && runiform() > connectedness;
}
}
Random Generation of bi-directional Graphs in Omnet, Omar Usman
Published in Khyber.ORG on Wednesday, July 4 2012 (http://www.khyber.org)
