def test_weighted_edge_count_float_weights(self): club = nx.karate_club_graph().copy() for index, (e1, e2) in enumerate(club.edges()): club.add_edge(e1, e2, weight=float(index) + 0.5) self.assertEqual(weighted_edge_count(club), 6084.0)
def test_weighted_edge_count(self): self.assertEqual(weighted_edge_count(nx.karate_club_graph()), 156.0)
def test_weighted_edge_count_weights(self): club = nx.karate_club_graph().copy() for index, (e1, e2) in enumerate(club.edges()): club[e1][e2] = { 'weight': index } self.assertEqual(weighted_edge_count(club), 6006.0)