[理工] NP問題
想請教三個問題,是P還是NP
1.Find a positive weight directed cycle in a weighted directed graph
2.(修正)Find the smallest cycle in a graph, where the edge-weight is 1 for e
ach edge
3.The 2-CNF-Satisfiability problem
我都認為是NP,不過爬文好像認為是P,想請教一下@@
(出自交大103資演)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.25.99
※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1486442120.A.03C.html
推
02/07 12:39, , 1F
02/07 12:39, 1F
所以是只要測出有cycle就好嗎?
→
02/07 12:40, , 2F
02/07 12:40, 2F
二打錯了,我應該是要問
Find the smallest cycle in a graph, where the edge-weight is 1 for each edge
→
02/07 12:41, , 3F
02/07 12:41, 3F
推
02/07 12:42, , 4F
02/07 12:42, 4F
→
02/07 12:43, , 5F
02/07 12:43, 5F
原來如此!
推
02/07 12:52, , 6F
02/07 12:52, 6F
推
02/07 12:56, , 7F
02/07 12:56, 7F
→
02/07 13:42, , 8F
02/07 13:42, 8F
啊,是用DFS然後看back edge?
※ 編輯: ssssIssss (140.112.25.99), 02/07/2017 13:46:02
→
02/07 13:48, , 9F
02/07 13:48, 9F
Topological跑完不是是求出先後順序嗎,要如何化為找positive cycle呢?
※ 編輯: ssssIssss (140.112.25.99), 02/07/2017 13:50:44
推
02/07 13:54, , 10F
02/07 13:54, 10F
→
02/07 13:54, , 11F
02/07 13:54, 11F
推
02/07 14:03, , 12F
02/07 14:03, 12F
→
02/07 14:03, , 13F
02/07 14:03, 13F
→
02/07 14:04, , 14F
02/07 14:04, 14F
→
02/07 14:05, , 15F
02/07 14:05, 15F
→
02/07 14:05, , 16F
02/07 14:05, 16F
→
02/07 14:06, , 17F
02/07 14:06, 17F
→
02/07 14:06, , 18F
02/07 14:06, 18F
推
02/07 14:07, , 19F
02/07 14:07, 19F
→
02/07 14:07, , 20F
02/07 14:07, 20F
→
02/07 14:07, , 21F
02/07 14:07, 21F
推
02/07 14:07, , 22F
02/07 14:07, 22F
→
02/07 14:08, , 23F
02/07 14:08, 23F
→
02/07 14:08, , 24F
02/07 14:08, 24F
→
02/07 14:10, , 25F
02/07 14:10, 25F
→
02/07 14:11, , 26F
02/07 14:11, 26F
懂!感謝各位解惑!
※ 編輯: ssssIssss (140.112.25.99), 02/07/2017 14:27:51
討論串 (同標題文章)