Problem 936

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Post Reply
User avatar
SAG145
Posts: 41
Joined: Thu Apr 11, 2024 10:25 pm

Problem 936

Post by SAG145 »

Can someone please explain to me what the definitions of a tree and a degree are? Because I don't understand why, for example, a line of 7 vertices, each connected to the next vertex with an edge, doesn't satisfy the conditions?
Image
DJohn
Posts: 90
Joined: Sat Oct 11, 2008 12:24 pm

Re: Problem 936

Post by DJohn »

A tree is a connected graph with no loops. So a collection of vertices, with edges between them, such that for any pair of vertices there is exactly one path between them. The degree of a vertex is the number of edges attached to it.

All of the examples in the problem are trees. The top-left one has one vertex of degree 6 and six of degree 1. It's peerless because none of the vertices with degree 1 are directly connected with an edge.

Your example, A--B--C--D--E--F--G, is a tree, but there's an edge between vertices B and C, which are both degree 2. So it is not peerless.

(It's worth pointing out that the vertices are not labelled. A--B--C and A--C--B are the same tree with different labelling. I've only given your example labels to make it possible to talk about it)
Post Reply