Show that the 3-color problem is in P when the input graph is a tree.












0












$begingroup$


This one is from university assignment. I am completely stuck on this one and I searched the internet but couldn't find a explanation.




Show that the 3-color problem is in P when the input graph is a tree.




Any explanation would be appreciated.










share|cite|improve this question











$endgroup$








  • 2




    $begingroup$
    Every tree is $2$-colorable, so I'm not quite getting the question.
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:09










  • $begingroup$
    yeah I know but thats what the question states. I have no clue.
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:11
















0












$begingroup$


This one is from university assignment. I am completely stuck on this one and I searched the internet but couldn't find a explanation.




Show that the 3-color problem is in P when the input graph is a tree.




Any explanation would be appreciated.










share|cite|improve this question











$endgroup$








  • 2




    $begingroup$
    Every tree is $2$-colorable, so I'm not quite getting the question.
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:09










  • $begingroup$
    yeah I know but thats what the question states. I have no clue.
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:11














0












0








0





$begingroup$


This one is from university assignment. I am completely stuck on this one and I searched the internet but couldn't find a explanation.




Show that the 3-color problem is in P when the input graph is a tree.




Any explanation would be appreciated.










share|cite|improve this question











$endgroup$




This one is from university assignment. I am completely stuck on this one and I searched the internet but couldn't find a explanation.




Show that the 3-color problem is in P when the input graph is a tree.




Any explanation would be appreciated.







graph-theory computational-complexity coloring np-complete






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 29 '18 at 21:41









gt6989b

33.6k22453




33.6k22453










asked Nov 29 '18 at 21:06









r4dicalbuRnr4dicalbuRn

31




31








  • 2




    $begingroup$
    Every tree is $2$-colorable, so I'm not quite getting the question.
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:09










  • $begingroup$
    yeah I know but thats what the question states. I have no clue.
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:11














  • 2




    $begingroup$
    Every tree is $2$-colorable, so I'm not quite getting the question.
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:09










  • $begingroup$
    yeah I know but thats what the question states. I have no clue.
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:11








2




2




$begingroup$
Every tree is $2$-colorable, so I'm not quite getting the question.
$endgroup$
– Cheerful Parsnip
Nov 29 '18 at 21:09




$begingroup$
Every tree is $2$-colorable, so I'm not quite getting the question.
$endgroup$
– Cheerful Parsnip
Nov 29 '18 at 21:09












$begingroup$
yeah I know but thats what the question states. I have no clue.
$endgroup$
– r4dicalbuRn
Nov 29 '18 at 21:11




$begingroup$
yeah I know but thats what the question states. I have no clue.
$endgroup$
– r4dicalbuRn
Nov 29 '18 at 21:11










1 Answer
1






active

oldest

votes


















1












$begingroup$

UPDATED following a suggestion in the comments.




  1. Validate that the input is a tree

  2. Answer "yes"


Both (1) and (2) are doable in polynomial time (how?) so this is in $P$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:33










  • $begingroup$
    @semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:40








  • 1




    $begingroup$
    One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:41










  • $begingroup$
    @CheerfulParsnip :-) +1, funny, yes, definitely
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:43








  • 1




    $begingroup$
    @semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:47











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3019221%2fshow-that-the-3-color-problem-is-in-p-when-the-input-graph-is-a-tree%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1












$begingroup$

UPDATED following a suggestion in the comments.




  1. Validate that the input is a tree

  2. Answer "yes"


Both (1) and (2) are doable in polynomial time (how?) so this is in $P$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:33










  • $begingroup$
    @semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:40








  • 1




    $begingroup$
    One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:41










  • $begingroup$
    @CheerfulParsnip :-) +1, funny, yes, definitely
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:43








  • 1




    $begingroup$
    @semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:47
















1












$begingroup$

UPDATED following a suggestion in the comments.




  1. Validate that the input is a tree

  2. Answer "yes"


Both (1) and (2) are doable in polynomial time (how?) so this is in $P$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:33










  • $begingroup$
    @semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:40








  • 1




    $begingroup$
    One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:41










  • $begingroup$
    @CheerfulParsnip :-) +1, funny, yes, definitely
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:43








  • 1




    $begingroup$
    @semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:47














1












1








1





$begingroup$

UPDATED following a suggestion in the comments.




  1. Validate that the input is a tree

  2. Answer "yes"


Both (1) and (2) are doable in polynomial time (how?) so this is in $P$






share|cite|improve this answer











$endgroup$



UPDATED following a suggestion in the comments.




  1. Validate that the input is a tree

  2. Answer "yes"


Both (1) and (2) are doable in polynomial time (how?) so this is in $P$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Nov 29 '18 at 21:43

























answered Nov 29 '18 at 21:27









gt6989bgt6989b

33.6k22453




33.6k22453












  • $begingroup$
    Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:33










  • $begingroup$
    @semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:40








  • 1




    $begingroup$
    One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:41










  • $begingroup$
    @CheerfulParsnip :-) +1, funny, yes, definitely
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:43








  • 1




    $begingroup$
    @semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:47


















  • $begingroup$
    Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
    $endgroup$
    – r4dicalbuRn
    Nov 29 '18 at 21:33










  • $begingroup$
    @semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:40








  • 1




    $begingroup$
    One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
    $endgroup$
    – Cheerful Parsnip
    Nov 29 '18 at 21:41










  • $begingroup$
    @CheerfulParsnip :-) +1, funny, yes, definitely
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:43








  • 1




    $begingroup$
    @semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
    $endgroup$
    – gt6989b
    Nov 29 '18 at 21:47
















$begingroup$
Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
$endgroup$
– r4dicalbuRn
Nov 29 '18 at 21:33




$begingroup$
Does this prove that 3-color is in P? 2-coloring can be done by BFS and tree is a bipartite by definition. But what about 3-color?
$endgroup$
– r4dicalbuRn
Nov 29 '18 at 21:33












$begingroup$
@semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
$endgroup$
– gt6989b
Nov 29 '18 at 21:40






$begingroup$
@semal259 any 2-coloring is also a 3-coloring, so it does indeed prove that 3-coloring a tree is in $P$
$endgroup$
– gt6989b
Nov 29 '18 at 21:40






1




1




$begingroup$
One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
$endgroup$
– Cheerful Parsnip
Nov 29 '18 at 21:41




$begingroup$
One could argue that it's even simpler than this, since the $2$-color problem should have a yes/no answer. Just write a program that always produces the answer yes (possibly after verifying that the input is a tree.)
$endgroup$
– Cheerful Parsnip
Nov 29 '18 at 21:41












$begingroup$
@CheerfulParsnip :-) +1, funny, yes, definitely
$endgroup$
– gt6989b
Nov 29 '18 at 21:43






$begingroup$
@CheerfulParsnip :-) +1, funny, yes, definitely
$endgroup$
– gt6989b
Nov 29 '18 at 21:43






1




1




$begingroup$
@semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
$endgroup$
– gt6989b
Nov 29 '18 at 21:47




$begingroup$
@semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
$endgroup$
– gt6989b
Nov 29 '18 at 21:47


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3019221%2fshow-that-the-3-color-problem-is-in-p-when-the-input-graph-is-a-tree%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa