iterator usedin writing grapg to file