tanzeel wrote:its difficult to make this recursive, its real trouble implementing with graphical programing.suggest any LV recursive algorithm.How you store your data, is not necessarily how you display your data. What I would do is to make an array of clusters (or classes if you are familiar with objects) detailing the properties of a pipe and a tap.Pipe{int pipeNumber, int ConnectedPipes[ ], int connectedTaps[ ], bool Status, bool Visited};Tap{tapNumber, int Connected Pipes[ ], bool Status, bool Visited};Each object has a unique ID - this could be the index of the object in the containing array and could be done away with.Each object has an array detailing which pipes it is connect toPipes can be connected to pipes and taps, taps can only be conneted to pipesbool Status is the boolean stats of whether the pipe has a flow in it / tap is openvool Visited is a flag for the recursion algorithmWhen the network of pipes is constructed, each instance of a pipe and a tap has a record of which pipes and taps they are connected to. When a tap status change event is triggered, we start at the gas source and follow reference numbers down through open taps, changing the visited flag and the status to true, until we hit a closed tap. Then recurse back up through the visited nodes until there is an unvisited node below, and follow that path down to a closed node. In practical terms, Each node would probably be better placed on a FILO stack to give a more efficient memory footprint than having the whole network copied in working memory, and also do away with the 'visited' flag.After we have determined the status of the nodes, we can update the display in one action.I realise that you will have to do a rewrite of your program**, but given the size you mentioned of your pipes network, this may well be quicker - and definately more elegant - than adding hundreds of events to your already fairly substantial event structure. Lastly, I cannot think of a reason why a local variable would be used anywhere.Apologies if this was a bit rambling, I tried to keep it concise.**Addendum"... rewrite of your program" - but not the time consuming part of redrawing your front panel. Additionally as each pipe and tap should have its own unique name you could put that into the object ID. Message Edited by yenknip on 08-06-2008 02:35 PM