编写一个程序来检查,如果一个图是二部程序

2023-09-11 01:57:43 作者:Maiden 少女

我需要写检查程序:如果一个图是二分。

I need to write a program that check if a graph is bipartite.

我已经经历了维基百科的文章阅读图着色和的二部图。这两篇文章暗示方法来测试bipartiteness像BFS搜索,但我不能写一个程序实现这些方法。

I have read through wikipedia articles about graph coloring and bipartite graph. These two article suggest methods to test bipartiteness like BFS search, but I cannot write a program implementing these methods.

推荐答案

你为什么不能?你的问题使得它很难有人甚至写你的计划,因为你甚至没有提到具体的语言......

Why can't you? Your question makes it hard for someone to even write the program for you since you don't even mention a specific language...

我们的想法是,开始通过将随机节点插入到先进先出的队列(也