Esempio n. 1
0
 def test_neighborhood(self):
     n_a = Neighborhood.get(self.a, self.edges)
     n_b = Neighborhood.get(self.b, self.edges)
     n_c = Neighborhood.get(self.c, self.edges)
     n_d = Neighborhood.get(self.d, self.edges)
     self.assertTrue(Edges({self.e1, self.e2}) == n_a)
     self.assertTrue(Edges({self.e3, self.e4}).isdisjoint(n_a))
     self.assertTrue(Edges({self.e1, self.e4}) == n_b)
     self.assertTrue(Edges({self.e2, self.e3}).isdisjoint(n_b))
     self.assertTrue(Edges({self.e3}) == n_c)
     self.assertTrue(Edges({self.e1, self.e2, self.e4}).isdisjoint(n_c))
     self.assertTrue(Edges({self.e2, self.e3, self.e4}) == n_d)
     self.assertTrue(Edges({self.e1}).isdisjoint(n_d))
Esempio n. 2
0
 def compute(self, edges):
     ns = set()
     for e in Neighborhood.get(self.v, edges):
         ns.add(e.adjacent(self.v))
     self.neighbors = Vertices(ns)