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












0














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




















  • 2




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










  • yeah I know but thats what the question states. I have no clue.
    – semal259
    Nov 29 at 21:11
















0














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




















  • 2




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










  • yeah I know but thats what the question states. I have no clue.
    – semal259
    Nov 29 at 21:11














0












0








0







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















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 at 21:41









gt6989b

33k22452




33k22452










asked Nov 29 at 21:06









semal259

31




31








  • 2




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










  • yeah I know but thats what the question states. I have no clue.
    – semal259
    Nov 29 at 21:11














  • 2




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










  • yeah I know but thats what the question states. I have no clue.
    – semal259
    Nov 29 at 21:11








2




2




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




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












yeah I know but thats what the question states. I have no clue.
– semal259
Nov 29 at 21:11




yeah I know but thats what the question states. I have no clue.
– semal259
Nov 29 at 21:11










1 Answer
1






active

oldest

votes


















1














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























  • 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?
    – semal259
    Nov 29 at 21:33










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








  • 1




    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.)
    – Cheerful Parsnip
    Nov 29 at 21:41










  • @CheerfulParsnip :-) +1, funny, yes, definitely
    – gt6989b
    Nov 29 at 21:43








  • 1




    @semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
    – gt6989b
    Nov 29 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














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























  • 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?
    – semal259
    Nov 29 at 21:33










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








  • 1




    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.)
    – Cheerful Parsnip
    Nov 29 at 21:41










  • @CheerfulParsnip :-) +1, funny, yes, definitely
    – gt6989b
    Nov 29 at 21:43








  • 1




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
















1














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























  • 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?
    – semal259
    Nov 29 at 21:33










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








  • 1




    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.)
    – Cheerful Parsnip
    Nov 29 at 21:41










  • @CheerfulParsnip :-) +1, funny, yes, definitely
    – gt6989b
    Nov 29 at 21:43








  • 1




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














1












1








1






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














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 at 21:43

























answered Nov 29 at 21:27









gt6989b

33k22452




33k22452












  • 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?
    – semal259
    Nov 29 at 21:33










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








  • 1




    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.)
    – Cheerful Parsnip
    Nov 29 at 21:41










  • @CheerfulParsnip :-) +1, funny, yes, definitely
    – gt6989b
    Nov 29 at 21:43








  • 1




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


















  • 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?
    – semal259
    Nov 29 at 21:33










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








  • 1




    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.)
    – Cheerful Parsnip
    Nov 29 at 21:41










  • @CheerfulParsnip :-) +1, funny, yes, definitely
    – gt6989b
    Nov 29 at 21:43








  • 1




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
















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?
– semal259
Nov 29 at 21:33




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?
– semal259
Nov 29 at 21:33












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






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






1




1




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.)
– Cheerful Parsnip
Nov 29 at 21:41




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.)
– Cheerful Parsnip
Nov 29 at 21:41












@CheerfulParsnip :-) +1, funny, yes, definitely
– gt6989b
Nov 29 at 21:43






@CheerfulParsnip :-) +1, funny, yes, definitely
– gt6989b
Nov 29 at 21:43






1




1




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




@semal259 Indeed, a tree is $k$-colorable in polynomial time for all $k ge 2$.
– gt6989b
Nov 29 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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.


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

Wiesbaden

Marschland

Dieringhausen