shortest path algorithm - utilites

the necessary graph implementation for shortest path alogrithm.
those methods can be helpful for other algorithms which require a graph, i can remove if its really necessary