示例#1
0
文件: tests.py 项目: andresgz/ekratia
 def test_graph_level0(self):
     G = self.G
     G.add_edge(2, 1)
     G.add_edge(3, 1)
     G.add_edge(4, 1)
     self.assertEqual(graphs.get_graph_value(G, 1), 4.0)
     self.assertEqual(graphs.get_graph_value(G, 2), 1)
     self.assertEqual(graphs.get_graph_value(G, 3), 1)
     self.assertEqual(graphs.get_graph_value(G, 4), 1)
示例#2
0
文件: tests.py 项目: andresgz/ekratia
 def test_graph_level2(self):
     G = self.G
     G.add_edge(3, 1)
     G.add_edge(4, 1)
     G.add_edge(4, 2)
     self.assertEqual(graphs.get_graph_value(G, 1), 2.5)
     self.assertEqual(graphs.get_graph_value(G, 2), 1.5)
     self.assertEqual(graphs.get_graph_value(G, 3), 1)
     self.assertEqual(graphs.get_graph_value(G, 4), 1)
示例#3
0
文件: models.py 项目: ekratia/ekratia
 def get_graph_value(self):
     graph = self.get_graph()
     return get_graph_value(graph, self.id)