changed nodes to variables, put img_to_graph in test_loopy, initialized xy_fctor and neighbour_factor'