diff --git a/independentset.py b/independentset.py index ae0ec4e..f2b063f 100644 --- a/independentset.py +++ b/independentset.py @@ -24,7 +24,7 @@ def planar_independent_set(graph: Graph, black_list: List=list(), degree_lim=IND """ unmarked_nodes = { node - for node in graph.nodes_iter() + for node in list(graph.nodes) if graph.degree(node) <= degree_lim and node not in black_list } diff --git a/kirkpatrick.py b/kirkpatrick.py index bdd23d5..f9ae3d4 100644 --- a/kirkpatrick.py +++ b/kirkpatrick.py @@ -250,7 +250,7 @@ def locate(self, p: Point, plot_search=False) -> Optional[Polygon]: plt.clf() i = 1 - while len(self.digraph.neighbors(curr)) > 1: + while len(list(self.digraph.neighbors(curr))) > 1: for node in self.digraph.neighbors(curr): if p in node: curr = node @@ -270,11 +270,11 @@ def locate(self, p: Point, plot_search=False) -> Optional[Polygon]: i+=1 # Access the original tile just below the polygon if it exists - neighbors = self.digraph.neighbors(curr) + neighbors = list(self.digraph.neighbors(curr)) if len(neighbors) == 1: curr = neighbors[0] - if self.digraph.node[curr]["original"]: + if self.digraph.nodes[curr]["original"]: return curr return None @@ -323,4 +323,4 @@ def time_tests(min_pts: int=10, max_pts: int=100, inc=5, n_iter=100) -> List[Poi located_tile = locator.locate(query_point, plot_search=True) - print(located_tile) \ No newline at end of file + print(located_tile)