Commits

committed 073b4da

src/hornet/contrib/networkabstractor.py

`         ## those attributes are really the same attributes `
`         for anode in self.graph.nodes_iter():`
`             if self.graph.has_edge(anode, anode):`
`-                edge = self.graph.get_edge(anode, anode) `
`+                edge = self.graph[anode][anode] `
`                 anode.size -= edge.size`
`         `
`     def _find_node_abstractions(self, node):`

src/hornet/network/__init__.py

`     directions = {}`
`     for edge in graph.edges_iter(data=True):`
`         e = edge[0:2]`
`-        other = (e[1], e[0])`
`-        if graph.has_edge(*other):`
`+        if graph.has_edge(e[1], e[0]):`
`             # both directions exist, so we can do the calculation`
`-            ratio = edge[2].joint / graph.get_edge(*other).joint`
`+            ratio = edge[2].joint / graph[e[1]][e[0]].joint`
`         else:`
`             # the return edge does not exist, so the edge only occurs in this`
`             # direction`

tests/test_contrib/test_networkbuilder.py

`         add_edge(self.graph, nC, nA, size=2)`
`         `
`         compute_similarities(self.graph)`
`-        self.assertEqual(0.75, self.graph.get_edge(nA, nB).similarity)`
`-        self.assertEqual(0.75, self.graph.get_edge(nB, nA).similarity)`
`-        self.assertEqual(0.25, self.graph.get_edge(nA, nC).similarity)`
`-        self.assertEqual(0.25, self.graph.get_edge(nC, nA).similarity)`
`+        self.assertEqual(0.75, self.graph[nA][nB].similarity)`
`+        self.assertEqual(0.75, self.graph[nB][nA].similarity)`
`+        self.assertEqual(0.25, self.graph[nA][nC].similarity)`
`+        self.assertEqual(0.25, self.graph[nC][nA].similarity)`
` `
`     def test_multiple_edges_not_equal(self):`
`         nA = Node('a', 16)`
`         add_edge(self.graph, nC, nA, size=2)`
`         `
`         compute_similarities(self.graph)`
`-        self.assertEqual(0.75, self.graph.get_edge(nA, nB).similarity)`
`-        self.assertEqual(0.5, self.graph.get_edge(nB, nA).similarity)`
`-        self.assertEqual(0.5, self.graph.get_edge(nA, nC).similarity)`
`-        self.assertEqual(0.25, self.graph.get_edge(nC, nA).similarity)`
`+        self.assertEqual(0.75, self.graph[nA][nB].similarity)`
`+        self.assertEqual(0.5, self.graph[nB][nA].similarity)`
`+        self.assertEqual(0.5, self.graph[nA][nC].similarity)`
`+        self.assertEqual(0.25, self.graph[nC][nA].similarity)`
` `
` class NodeLookupTest(TestCase):`
`     def setUp(self):`