Anonymous avatar Anonymous committed 073b4da

Comments (0)

Files changed (3)

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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.