added function to calculate cost on the networks. Added code for animation of active link sets