changed stucture of graph and updated maxflow