        set DIRE 
	set statusbar
	set lst
	set changed
	set indexout
 
	set lstbx2 [list "In 1999, Barabasi and Albert create the BA model which is inspired to the formation of the World Wide Web and is based on two basic characteristics: growth and perferential attachment. The idea derived that sites with high degrees acquire new links at higher rates than low-degree nodes. Staring with M0 isolated nodes, at each time step a new node i with M (M<M0) links is added to the networks.\n\nexample:\nba M0 M T\nM0: the initial node number\nM: number of links added into the network every time step\nT: the evolutionary time" \
	"The study of random graph was initiated by Erdos and Renyi in 1959. The evolutionary rule is creating N nodes at first, then there existed one link with probability P between arbitrary two nodes. People will get one random network model with N nodes, about pN(N-1) links.\n\nexample:\ner N K\nN: the node number of the network\nK: the average degree" \
	"In 1998, Watts and Strogatz (WS) purposed a small-world model having both the small-world property and a high clustering coefficient. The model is based on a rewiring procedure of the edges implemented with a probability p. The starting point is a N nodes ring, in which each node is symmetrically connected to its K=2m nearest neighbors. Then, for every node, each link connected to a clockwise neighbors is rewired to a randomly chosen node with a probability p. Note here K is even in the ws function.\n\nexample:\nws N K P\nN: the node number of the network\nK: the average degree\nP: the rewiring probability" \
	"In 2004, Alain Barrat, Marc Barthlemy and Alessandro Vespignani(BBV) propose a model for the growth of weighted networks that couple the establishment of new edges and vertices and the weights' dynamic evolutional. The model is based on a simple weight-driven dynamics.\n\nexample:\nbbv M0 M T W0 delta\nM0: the initial node number\nM: number of links added into the network every time step\nT: the evolutionary time\nW0: the initial edge weight\ndelta: the weight introduced by the new link every time step" \
	"In order to create the community structure - groups of vertices within which connections are dense but between which they are sparser. The com function will create one derivational community model. The evolutionary rules like BA models, however, every time step, the new node will add oedge edge into other communties and inedge into the given communties where it attached\n\nexample:\ncom C Nodenum M0 oedge inedge\nC: the number of communities\nNodenum: the nubmer of the whole network\nM0: the number of the initial nodes\nodege: the outer-attaching number\nindege: the inter-attaching number" \
	"Node betweenness measures the nubmer of geodesics going through it.bet function elect the fast algorithm purposed by Konstanzin 2001. Here t is the matrix converted by tran, the output result record the betweenness of every node. Notices that the betweeness is only used to calculate the undirected network without loops.\n\nexample\nbet\nNo parameter, but users must create one graph model firstly." \
	"eff function will calculate the efficiency of networks which is the harmonic mean of geodesic lengths.\n\nexample\neff\nNo parameter, but users must create one graph model firstly. Users could observe the result in the result label." \
	"assc function will calculate the assortive mixing parameter in Networks purposed by Mark Newman in 2002. A network is said to show assortative mixing if the nodes in the network that have many connections tend to be connected to other nodes with many connections, and show disassortative mixing reversely. Here when r>0, network is assortative, when r<0, network is disassortative.\n\nexample\nassc\nNo parameter, but users must create one graph model firstly. Users could observe the result in the result label." \
	"cluster function calculates the clustering coefficient C, a measure introduced by Watts and Strogatz.\n\nexample\ncluster\nNo parameter, but users must create one graph model firstly. Users could observe the result in the result label. " \
	"sis function describes epidemic process the susceptible-infected-susceptible(SIS) model.\n\nexample\nsis N T N0 P\nN: the node number of the network\nT: the evolutionary time\nN0: the initial infected node number\nP: the infected probability " \
	"Considered some diseases have relapse characteristics, scholars study the SIRS process. SIRS presents 'susceptible-infected-refractory-susceptible' periodic process. Input the node number of the network N, the evolutionary time step T, the initial infected node number N0, the persistence of infected status is Ti time step, the persistence of refractory status is Tr time step. Notes that for sirs process, when is Tr is large enough, the sirs equals the sir process.\n\nexample\nsirs N T N0 Ti Tr P\nN: the node number of the SIRS model\nT: the epidemic time step\nN0: the initial infected node\nTI: the infected state holding time, then the node will change its status to refractory state\nTR: the refractory state holding time, then the node will change its status to suspectible state\nP: the infected probability" \
	"A simple attack simulation. The model will delete one node or link according to some rules every time step. It is easy to find the different percolation characteristics for ditinctive network model.\n\nexample\nattack t flag\nt: the attack time step\nflag: 0 remove one node randomly\n1 remove one link randomly\n2 remove the node with the maximum degree " \
	"Display the graph of the network using a hiberarchy method.\n\nexample\ndraw_graph\nNo parameter. But users must create one model first. " \
	"Display the degree distribution\n\nexample\ndraw_degree\nNo parameter. But users must create one model first. " \
	"Display the relationship between betweenness and degree\n\nexample\ndraw_betweenness\nNo parameter. But users must create one model fisrt." \
	"Display the community distribution\n\example \ndraw_com\nNo parameter. But users must create one model first." \
	"Mark the infected node in the graph. The infected node will have a larger diameter.\n\nexample\nmark_sis\nNo parameter. But there is must a draw_graph command before the mark_sis." \
	"Plot the infected distribution with the disease evolution.\n\nexample\nplot_inf\nNo parameter. But there is must a sirs or sis epidemic process before the plot_inf."]

	set addwin .addwin
	toplevel $addwin

	frame $addwin.frame -borderwidth .5c
	pack $addwin.frame -side top -expand yes -fill both
	scrollbar $addwin.frame.scroll -command [list $addwin.frame.list yview]
	set lstbx1 [listbox $addwin.frame.list -yscrollcommand [list $addwin.frame.scroll set] \
		-setgrid 1 -height 12]
	pack $addwin.frame.list -side left -expand 1 -fill both
	pack $addwin.frame.scroll -side left -fill y
        $lstbx1 insert 0 ba er ws bbv com bet eff assc cluster \
		sis sirs attack draw_graph \
		draw_degree draw_betweenness draw_com mark_sis plot_inf
	bind $addwin.frame.list <ButtonRelease> Expln

	labelframe $addwin.frame.frm -text explainations:
	pack $addwin.frame.frm -side left -expand 1 -fill both
	set txt [text $addwin.frame.frm.txt  -setgrid true -wrap word -state normal\
		-yscrollcommand [list $addwin.frame.frm.scroll set] -width\
	       	22 -height 12 -font "Helvetica 10"]
	scrollbar $addwin.frame.frm.scroll -command [list $addwin.frame.frm.txt yview]
	pack $addwin.frame.frm.txt -side left -fill both -expand true
	pack $addwin.frame.frm.scroll -side left -fill y 

	frame $addwin.argus
	pack $addwin.argus -side top -expand no -fill x
	label $addwin.argus.label -text "Argus:" -padx 0
	pack $addwin.argus.label -side left -expand yes -fill x
	for {set i 0} {$i < 6} {incr i 1} {
		entry $addwin.argus.entry$i -width 10 -relief sunken\
			-textvariable args$i
		set args$i ""
		pack $addwin.argus.entry$i -side left -padx 5 -expand yes -fill x
	}
	for {set i 0} {$i < 6} {incr i 1} {
		set args$i ""
	}

	frame $addwin.frame2
	pack $addwin.frame2 -side top -expand no -fill x
	button $addwin.frame2.choose -text InsertBefore -command {InsrtBefore args0 args1 args2 args3 args4 args5}
	button $addwin.frame2.instafter -text InsertAfter -command {InsrtAfter args0 args1 args2 args3 args4 args5}
	pack $addwin.frame2.choose $addwin.frame2.instafter -side left -padx 5 -pady 3 

	set indexget [$lstbx1 curselection]
proc Expln {} {
	global lstbx1 lstbx2 txt DIRE
	$txt config -state normal
	$txt delete 1.0 end
	set index [$lstbx1 curselection]
	if {[llength $index] ==1 } {
		$txt insert end [lindex $lstbx2 $index]
		$txt config -state disabled
	}
}

proc InsrtBefore {args0 args1 args2 args3 args4 args5} {
	global lstbx1 lst indexout indexget changed statusbar
	set changed 1
	set statusbar Modified
	set indexget [$lstbx1 curselection]
	set inslst [$lstbx1 get $indexget]
	set space ""
	upvar 1 $args0 arg0
	upvar 1 $args1 arg1
	upvar 1 $args2 arg2
	upvar 1 $args3 arg3
	upvar 1 $args4 arg4
	upvar 1 $args5 arg5
	if {![string equal $arg0 $space]} {
		set inslst [concat $inslst $arg0]
	}
	if {![string equal $arg1 $space]} {
		set inslst [concat $inslst $arg1]
	}
	if {![string equal $arg2 $space]} {
		set inslst [concat $inslst $arg2]
	}
	if {![string equal $arg3 $space]} {
		set inslst [concat $inslst $arg3]
	}
	if {![string equal $arg4 $space]} {
		set inslst [concat $inslst $arg4]
	}
	if {![string equal $arg5 $space]} {
		set inslst [concat $inslst $arg5]
	}
        $lst insert $indexout $inslst
	for {set i 0} {$i<6} {incr i 1} {
		set arg$i ""
	}
}

proc InsrtAfter {args0 args1 args2 args3 args4 args5} {
	global lstbx1 lst indexout indexget changed statusbar
	set changed 1
	set statusbar Modified
	set indexget [$lstbx1 curselection]
	set inslst [$lstbx1 get $indexget]
	set space ""
	upvar 1 $args0 arg0
	upvar 1 $args1 arg1
	upvar 1 $args2 arg2
	upvar 1 $args3 arg3
	upvar 1 $args4 arg4
	upvar 1 $args5 arg5
	if {![string equal $arg0 $space]} {
		set inslst [concat $inslst $arg0]
	}
	if {![string equal $arg1 $space]} {
		set inslst [concat $inslst $arg1]
	}
	if {![string equal $arg2 $space]} {
		set inslst [concat $inslst $arg2]
	}
	if {![string equal $arg3 $space]} {
		set inslst [concat $inslst $arg3]
	}
	if {![string equal $arg4 $space]} {
		set inslst [concat $inslst $arg4]
	}
	if {![string equal $arg5 $space]} {
		set inslst [concat $inslst $arg5]
	}
	for {set i 0} {$i<6} {incr i 1} {
		set arg$i ""
	}
	incr indexout 1
        $lst insert $indexout $inslst
}



