Adding weight as a class member
Refactoring on graph methods