13 August 2011

Xgraph

Xgraph is an X-Windows application that includes:

  • interactive plotting and graphing
  • animation and deritives
  • portability and bug fixes

So to plot the characteristics of NS2 parameters like throughput, end to end delay, packets information, etc can be plotted using xgraph
The successful installation of NS2 will install xgraph also along with it.
To run xgraph from a shell prompt: # xgraph filename.xg

inside TCL scripts, xgraph can be written like this
exec xgraph filename.xg -geometry 500×500
if there are more xgraph files then,
exec xgraph filename1.xg -geometry 500×500 &
exec xgraph filename2.xg -geometry 500×500 &
The ambersand is mandatory to popup all the graph windows, if & (ambersand) is not there, then only the last xgraph window will be popped up.

Sample xgraph file and its contents
/*** The xgraph file shows the information about the overhead with size of the network,
Overhead is compared with four routing protocols like AODV, DSR, DSDV and NEAODV (my own algorithm)
the values are taken from various trace files.
To execute the following xgraph file, copy the following contents and save it as “example.xg” possibly (other formats also supported) and in the shell prompt # xgraph example.xg
TitleText: Overhead (Kbits/s) Vs Network Size
YUnitText: OverHead
XUnitText: Network Size (nodes)
“NEAODV”
200 100
400 350
600 800
800 1200

“AODV”
200 500
400 1600
600 2300
800 3700

“DSR”
200 100
400 320
600 400
800 600

“DSDV”
200 500
400 3700
600 6400
800 11600
Output window will be looking like this