# grinpy.functions.number_of_degree_one_nodes¶

grinpy.functions.number_of_degree_one_nodes(G)

Return the number of nodes of the graph with degree equal to 1.

A vertex with degree equal to 1 is also called a leaf.

G : graph
A NetworkX graph.
numNodes : int
The number of nodes in the graph with degree equal to 1.

number_of_nodes_of_degree_k, number_of_min_degree_nodes, number_of_max_degree_nodes

>>> G = nx.path_graph(3) # Path on 3 nodes
>>> nx.number_of_leaves(G)
2