Added getWeight method to Graph