Refactoring edge weight calculation to remove redundancy