ns2graph: RPI NS-2 Graphing and Statistics Package

Support This Project 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:
  1. Including the graph.tcl. See (1) in above script.
  2. Inserting code in the finish proc to cause the graph to pop-up. See (2) and (3).
  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.

Updated Sunday, April 29, 2007