Graph Implementation with weights