added weight support, not tested if works
 adding residual classes
dijkstra should be close to finished