title: How to show labels for ns2 nodes in nam animation and naming
body: <p>I am trying to build a topology in ns2 and it helps me if in the nam animation the nodes have names so I can understand easier if they are core switches or aggragation or ToR...</p>
  
  <p>I am using a loop to create them and set a label using the label attribute. My code is something like the following</p>
  
  <pre><code>for {set i 0} {$i &lt; 4} {incr i} {
      set c($i) [$ns node]
      $c($i) color red
      $c($i) shape hexagon
      $c($i) label "corei" 
      $c($i) label-color black
      $c($i) label-at up
  }
  
  
  $ns duplex-link $c(1) $c(2) 1Gb 10ms DropTail
  $ns duplex-link $c(3) $c(2) 1Gb 10ms DropTail
  </code></pre>
  
  <p>but when I am running it the nam only shows the hexagons with the number inside them which I assume is an internal counting.</p>
  
  <p>Any ideas what I am doing wrong? Incidentally would the line</p>
  
  <pre><code>$c($i) label "corei"
  </code></pre>
  
  <p>work if it was</p>
  
  <pre><code>$c($i) label "core$i"
  </code></pre>
  
  <p>it doesn't produce any errors but like I said no labels</p>
  
  <p>Other than that I was trying to use a naming format like pod_layer_pos for my nodes and I read the post at <a href="https://stackoverflow.com/questions/16407983/tcl-cant-read-variable-no-such-variable">Tcl can&#39;t read variable: no such variable</a> but I was wondering if when using arrays - associative - can I have more then one variable evaluated inside the parenthesis. For example can I have the following</p>
  
  <pre><code>$ns duplex-link $core($i) $pod($j_$k) 1Mb 10ms DropTail
  </code></pre>
  
  <p>Is there in general a specific way to group sets of node in a naming convention. What I am thinking is a fat-tree topology so for k=4 we have 4 core switches 4 pod with 2 layers, each having 2 switches, and the lower layer connected to 2 servers/hosts. So I was thinking to have the core in an array and connect them using loops with all the rest nodes where the name would be like something </p>
  
  <blockquote>
    <p>pod[0-(k-1)]_layer[0-1]_switch[0-k/2]</p>
  </blockquote>
  
  <p>The following seems to work but I want to make sure that it's not a fluke</p>
  
  <pre><code>set p 0
  set l 0
  set s 0
  
  set pod(0,0,0) [$ns node]
  set pod(0,0,1) [$ns node]
  
  for {set j 0} {$j &lt; 1} {incr j} {
      $ns duplex-link $pod($p,$l,$j) $pod($p,$l,[expr ($j+1)]) 1Gb 10ms DropTail
  }
  </code></pre>