Random Generation of bi-directional Graphs in Omnet :: Khyber.ORG

پښتو :: پښتانه :: پښتونخواه :: پښتونوالی

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

New Additions

[an error occurred while processing this directive]

From Archives

Kharoti's live around Kohistan and in the land from Koh e Suleiman to Birmal. Kharoti is a sub-tribe of the Ghilzai's. They have a long tribal rivalry with the Wazirs and the Nusairs over land they dispute to be theirs. Some of the important khels (sections) of the Kharoti are the . . . Read More

The story of colonization is not a pretty one. To the Pathans living in the North-west Frontier Province of what is now Pakistan, and particularly in its Tribal Area, it has meant destroyed villages, water-tanks and grain stores and a never ending series of "butcher and bolt" raids: an almost total failure in communication between two systems. . . . Read More

Lakki Marwat , Akram Khan Marwat

Before 1901, the boundary of the Marwat territory was touching the Khattak territory up to village Alamshiri on the north, Shumoni and Ahmadzai Wazir on the Northwest, to the West with Bannu near village Mama Khel, Rehmanzai Wazir near Sradarga, with District Tank Mullazai village, to the South near Kotka Sher Khan and Kotka Jamal and the East with Niazis near Dara Tang.After 1901, Almost twelve miles area of Lakki Marwat was amalgamated with Dera Ismail Khan and some villages were annexed to Tank District. Now the average width of the area from north to south is thirty-seven miles and the average length from east to west is fifty miles [2]. . . . Read More

Dotani : Iranica , Daniel Balland

Dotani is a Pashtun tribe of the Lodhi confederation and is still mainly nomadic. The Dotan's have sometims been included among the Lohani tribes because of common migratory patterns. All indigenous accounts point to a wholly independent status, however a few sources have provided the best discussion of internal subdivisions of the tribe . . . Read More

The Rise and Rise of Pashto , Dr. Sher Zaman Taizai

The first recorded manuscript of Pashto is Tazkaratul Awlia by Suleiman Mako, written in the year 1214. However, only 7 pages of the manuscript have survived and are documented by Allama Abdul Hai Habibi. Suleiman Mako is linked with the legendary father of Pashtuns; Qais Abdul Rashid by 5 generations as Mako, son of Panjpa, son of Abdali, son of Tarin, son of Sharakhbun, son of Qais. Poems are also attributed to Bet, son of Qais, however a manuscript of book from him cannot be verified. . . . Read More

To the Tribe on the Edge , Raza Khan Muhammadzai

There is very little authentic information available to the outside world about the Federally Administered Tribal Areas (FATA). The remoteness of the area, and the political vacuum . . . Read More

Random Generation of bi-directional Graphs in Omnet

Omar Usman

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:

  1. src/sim/distrib.cc
  2. include/distrib.h
  3. src/sim/nedfunctions.cc

Modifications to distrib.cc

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);
return l;

Modifications to distrib.h

Just one line to be modified here:

SIM_API double runiform(int rng=0);

Modifications to nedfunctions.cc

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.

"quantity runiform(int rng?)",
"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());

Compilation and Usage

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 {
int count;
double connectedness; // 0.0 submodules:
node[count]: Node {
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;

Comments powered by Disqus

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