Optimization, Operations Research, Python, Data Science, Editors Pick.
in self.neighbors: self.neighbors.append(node) def set_color(self, color: Color): self.color = color color.add_node() @property def neighbor_colors(self): return [n.color for n in self.neighbors if n.color is not None] @property def saturation(self): return len(set((n.color for n in self.neighbors