loop almost working, todo:solve problem to build graph