matrix added for shortest path
toMatrix
overhaul totally all