so is the following graph a claw?
the first graph
1 2
1 3
1 4
4 5
4 6
the second graph
1 2
1 3
1 4
2 5
3 6
4 7
and can anyone give me some hint of the algorithm?
thx.
![:o](./images/smilies/icon_eek.gif)
Moderator: Board moderators
Code: Select all
YES
YES
Well, a program which gets accepted would output 'YES' for both graphs, but none of those graphs are eligible to appear in the test-data, and If their shape is not claw.DP wrote:Output:Code: Select all
YES YES
thx.your hinit.Hadi wrote:NO
NO
.
Although none of your graphs would appear in the test-data. because the problem statement says all graphs has only vertices of degree 3.
HINT: All vertices has degree 3. So, If a vertex is the center of a claw, what can we conclude about its neighbors? What about the neighbors of a vertex which is not the center of a claw?