Reputation: 396
Can a node with a self-loop be a leaf node? Or maybe leaf is defined only for simple graphs (no self-loop, no multiple edges)? I can't find the answer. I found various definitions, but nowhere an answer for this.
Upvotes: 0
Views: 1431
Reputation: 11726
A graph with a loop isn't a tree but a graph with a cycle. Leaves are defined for trees only.
Let's take a more formal approach. A self-loop adds 2 to the degree of a vertex, or 1 to both indegree and outdegree in case of directed graphs. Assuming that a leaf is a vertex with outdegree 0 (and indegree 1, but that's guaranteed by a definition of a tree), a vertex with a self-loop cannot be a leaf.
Upvotes: 3