small refactor
refactored edge tuple from (u, v, w) to (w, u, v)
refactorings