Returns an iterator over all neighbors of node n in the dense graph.
(self, n)
| 235 | } |
| 236 | |
| 237 | def neighbors(self, n): |
| 238 | """Returns an iterator over all neighbors of node n in the |
| 239 | dense graph. |
| 240 | """ |
| 241 | try: |
| 242 | return iter(set(self._adj) - set(self._adj[n]) - {n}) |
| 243 | except KeyError as err: |
| 244 | raise NetworkXError(f"The node {n} is not in the graph.") from err |
| 245 | |
| 246 | class AntiAtlasView(Mapping): |
| 247 | """An adjacency inner dict for AntiGraph""" |