grinpy.functions.degree.number_of_nodes_of_degree_k¶
-
grinpy.functions.degree.
number_of_nodes_of_degree_k
(G, k)¶ Return the number of nodes of the graph with degree equal to k.
Parameters: - G (NetworkX graph) – An undirected graph.
- k (int) – A positive integer.
Returns: The number of nodes in the graph with degree equal to k.
Return type: int
See also
number_of_leaves()
,number_of_min_degree_nodes()
,number_of_max_degree_nodes()
Examples
>>> G = nx.path_graph(3) # Path on 3 nodes >>> nx.number_of_nodes_of_degree_k(G, 1) 2