MCPcopy Create free account
hub / github.com/alibaba/GraphScope / degree

Method degree

python/graphscope/nx/classes/graph.py:1468–1505  ·  view source on GitHub ↗

A DegreeView for the Graph as G.degree or G.degree(). The node degree is the number of edges adjacent to the node. The weighted node degree is the sum of the edge weights for edges incident to that node. This object provides an iterator for (node, degree) as well as

(self)

Source from the content-addressed store, hash-verified

1466 @property
1467 @clear_mutation_cache
1468 def degree(self):
1469 """A DegreeView for the Graph as G.degree or G.degree().
1470
1471 The node degree is the number of edges adjacent to the node.
1472 The weighted node degree is the sum of the edge weights for
1473 edges incident to that node.
1474
1475 This object provides an iterator for (node, degree) as well as
1476 lookup for the degree for a single node.
1477
1478 Parameters
1479 ----------
1480 nbunch : single node, container, or all nodes (default= all nodes)
1481 The view will only report edges incident to these nodes.
1482
1483 weight : string or None, optional (default=None)
1484 The name of an edge attribute that holds the numerical value used
1485 as a weight. If None, then each edge has weight 1.
1486 The degree is the sum of the edge weights adjacent to the node.
1487
1488 Returns
1489 -------
1490 If a single node is requested
1491 deg : int
1492 Degree of the node
1493
1494 OR if multiple nodes are requested
1495 nd_view : A DegreeView object capable of iterating (node, degree) pairs
1496
1497 Examples
1498 --------
1499 >>> G = nx.path_graph(4) # or DiGraph
1500 >>> G.degree[0] # node 0 has degree 1
1501 1
1502 >>> list(G.degree([0, 1, 2]))
1503 [(0, 1), (1, 2), (2, 2)]
1504 """
1505 return DegreeView(self)
1506
1507 def clear(self):
1508 """Remove all nodes and edges from the graph.

Callers 2

sizeMethod · 0.95
watts_strogatz_graphFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected