English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Problem 1 - Triangle Problem (TRIANGLE). A triangle in an undirected graph is a
subgraph that has 3 vertexes connected to each other (so that they form a triangle). We are asked
”Given an undirected graph G, does it contain triangle?”
Is TRIANGLE in P? if not, is it in NP?
• If the problem is in P give a polynomial-time algorithm that decides it;
• If the problem is in NP, but you cannot show that it is in P give a polynomial-time verifier.

2006-10-19 02:48:27 · 2 answers · asked by Z R 1 in Science & Mathematics Mathematics

2 answers

sure

2006-10-19 07:49:04 · answer #1 · answered by JJ M 2 · 0 0

This problem is in P, because if G has n vertices, then there are n(n-1)(n-2)/6 possible combinations of 3 vertices to check, and it takes O(1) time to check if any set of 3 vertices forms a triangle.

2006-10-19 14:49:58 · answer #2 · answered by James L 5 · 0 0

fedest.com, questions and answers