[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] regarding creating a topology
Hello ns-users, I'm asking a stupid question as I'm new to this ns and Tcl.
For creating a topology where every node is connected to each and every
other node I'm trying to use for-loop inside a for-loop in Tcl. But it's not
accepting that. Finally I cud achieve the topology in this way.
for {set i 0} {$i < 5} {incr i} {
set n($i) [$ns node]
}
for {set i 0} {$i < 4} {incr i} {
$ns duplex-link $n(0) $n([expr ($i +1)]) 1Mb 10ms SFQ
}
for {set i 1} {$i < 4} {incr i} {
$ns duplex-link $n(1) $n([expr ($i +1)]) 1Mb 10ms SFQ
}
for {set i 2} {$i < 4} {incr i} {
$ns duplex-link $n(2) $n([expr ($i +1)]) 1Mb 10ms SFQ
}
for {set i 3} {$i < 4} {incr i} {
$ns duplex-link $n(3) $n([expr ($i +1)]) 1Mb 10ms SFQ
}
In this way I've to use for-loop (n - 1) times for n nodes. I hope there
shud be a better way of doing this but I'm not able to achieve it. cud any
one pls help me.
regards,
Raj V Mudunuri.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp