## ns2graph: RPI NS-2 Graphing and Statistics Package

download from sourceforge

The Graphing and Statistics Package has been used since 2001
by researchers and students studying TCP/IP. It provides
TCL/C++ graph classes that are instantiated from within simulation
scripts. Here is a brief example excerpted from examples/ex1.tcl in
the ns2graph distribution.

source $env(NS)/tcl/rpi/graph.tcl (1)
[...]
set ns [new Simulator]
[...]
proc finish {} {
global util_graph (2)
$util_graph display (3)
exit 0
}
[...]
$ns duplex-link $s0 $n0 10M 4ms DropTail
$ns duplex-link $s1 $n0 10M 4ms DropTail
$ns duplex-link $n0 $n1 1.544M 4ms DropTail
$ns duplex-link $n1 $d0 10M 4ms DropTail
$ns duplex-link $n1 $d1 10M 4ms DropTail
[...]
$util_graph set util_graph [new Graph/UtilizationVersusTime $n0 $n1 0.1] (4)
$util_graph set title_ "Bottleneck Utilization vs Time" (5)
$ns at 5 finish
$ns run

As the above script completes execution, the following plot pops up:

Creation of the graph involved three steps:
- Including the graph.tcl. See (1) in above script.
- Inserting code in the finish proc to cause the graph to
pop-up. See (2) and (3).
- Inserting code to instantiate the Graph and to configure
its appearance. See (4) and (5).

### Comparison to Tracegraph

Tracegraph and ns2graph are different. If you do not know what you
want to plot, i.e., you want to run a short simulation and then
create graphs as post-processing then use Tracegraph. If you want
to run more complex simulations with reasonable execution times, you
know what plots you want, and/or you want to be able to regenerate
the graphs from your makefile as you tweak your protocol implementation then
use ns2graph.
- ns2graph is a set of TCL classes and C++ components. It integrates
directly into NS-2. Tracegraph post-processes traces generated by
NS-2.
- ns2graph installs components for gathering statistics during
simulation. It thus only collects the desired statistics.
Depending on the number and resolution of statistics gathered, this
can require several orders of magnitude less I/O resources than
generating full traces (as used by tracegraph).
- Tracegraph uses MATLAB as a backend to generate graphs. ns2graph
uses gnuplot as a back-end for generating most graphs.
- ns2graph uses only applications that are freely available:
gnuplot, xgraph, latex, pdflatex, and others. Tracegraph uses MATLAB.

* Updated Sunday, April 29, 2007 *