Returns an iterator for (node, degree) and degree for single node. The node degree is the number of edges adjacent to the node. Parameters ---------- nbunch : iterable container, optional (default=all nodes) A container of nodes. The container will be i
(self)
| 314 | |
| 315 | @cached_property |
| 316 | def degree(self): |
| 317 | """Returns an iterator for (node, degree) and degree for single node. |
| 318 | |
| 319 | The node degree is the number of edges adjacent to the node. |
| 320 | |
| 321 | Parameters |
| 322 | ---------- |
| 323 | nbunch : iterable container, optional (default=all nodes) |
| 324 | A container of nodes. The container will be iterated |
| 325 | through once. |
| 326 | |
| 327 | weight : string or None, optional (default=None) |
| 328 | The edge attribute that holds the numerical value used |
| 329 | as a weight. If None, then each edge has weight 1. |
| 330 | The degree is the sum of the edge weights adjacent to the node. |
| 331 | |
| 332 | Returns |
| 333 | ------- |
| 334 | deg: |
| 335 | Degree of the node, if a single node is passed as argument. |
| 336 | nd_iter : an iterator |
| 337 | The iterator returns two-tuples of (node, degree). |
| 338 | |
| 339 | See Also |
| 340 | -------- |
| 341 | degree |
| 342 | |
| 343 | Examples |
| 344 | -------- |
| 345 | >>> G = nx.path_graph(4) |
| 346 | >>> G.degree(0) # node 0 with degree 1 |
| 347 | 1 |
| 348 | >>> list(G.degree([0, 1])) |
| 349 | [(0, 1), (1, 2)] |
| 350 | |
| 351 | """ |
| 352 | return self.AntiDegreeView(self) |
| 353 | |
| 354 | def adjacency(self): |
| 355 | """Returns an iterator of (node, adjacency set) tuples for all nodes |
no outgoing calls