Пример #1
0
 def test_pair_betweenness(self):
     """
     Checks to make sure that the sum of all pair betweennesses
     on a specific vertex are equal to its vertex betweenness.
     """
     _, pb = CONGO.edge_and_pair_betweenness(self.graph)
     vb = self.graph.betweenness()
     for v in pb:
         self.assertAlmostEqual(sum(pb[v].values()), vb[v])
Пример #2
0
 def test_pair_betweenness(self):
     """
     Checks to make sure that the sum of all pair betweennesses
     on a specific vertex are equal to its vertex betweenness.
     """
     _, pb = CONGO.edge_and_pair_betweenness(self.graph)
     vb = self.graph.betweenness()
     for v in pb:
         self.assertAlmostEqual(sum(pb[v].values()), vb[v])
Пример #3
0
 def test_edge_betweenness(self):
     """
     Checks that the implementation of edge_betweenness in
     edge_and_pair_betweenness matches that of igraph's
     graph.edge_betweenness.
     """
     ebtheirs = self.graph.edge_betweenness()
     ebmine, _ = CONGO.edge_and_pair_betweenness(self.graph)
     for e in self.graph.es:
         self.assertAlmostEqual(ebtheirs[e.index], ebmine[e.tuple])
Пример #4
0
 def test_edge_betweenness(self):
     """
     Checks that the implementation of edge_betweenness in
     edge_and_pair_betweenness matches that of igraph's
     graph.edge_betweenness.
     """
     ebtheirs = self.graph.edge_betweenness()
     ebmine, _ = CONGO.edge_and_pair_betweenness(self.graph)
     for e in self.graph.es:
         self.assertAlmostEqual(ebtheirs[e.index], ebmine[e.tuple])