HNUST-OJ-1806-图的遍历——广度优先搜索

HNUST-OJ-1806-图的遍历——广度优先搜索,第1张

目录

原题复刻

思想的火花 

代码实现 


原题复刻

思想的火花 

 1.bfs(运用自带库函数queue)

void bfs(graph &g,int v)
{
    cout<=0; w=nextadjves(g,u,w))
        {

            if(!vis[w])
            {
                cout<
代码实现 
#include
using namespace std;
#define MAX 100
typedef int VerTexType,qelemtype;
typedef int Arctype,status;
typedef struct
{
    VerTexType vexs[MAX];
    Arctype arcs[MAX][MAX];
    int vexnum,arcnum;


} graph;
VerTexType vertexdata(const graph &g,int i)
{
    return g.vexs[i];
}
int firstadjves(const graph &g,int v)
{
    for(int j=0; j>g.vexnum;
    for(int i=0; i>g.arcs[i][j];

    }


}
bool vis[MAX];
queueq;
void bfs(graph &g,int v)
{
    cout<=0; w=nextadjves(g,u,w))
        {

            if(!vis[w])
            {
                cout<

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/867894.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-12
下一篇 2022-05-12

发表评论

登录后才能评论

评论列表(0条)