用C++实的无向图广度优先遍历.docVIP

  • 15
  • 0
  • 约4.09千字
  • 约 5页
  • 2016-12-02 发布于贵州
  • 举报
用C实的无向图广度优先遍历

用C++实现的实现无向图的广度优先遍历 #includeiostream #includestring using namespace std; //图的邻接表存储表示 #define MAX_NAME 5 // 顶点字符串的最大长度 #define MAX_VERTEX_NUM 20 typedef char VertexType[MAX_NAME]; typedef struct ArcNode{ //表结点 int adjvex; struct ArcNode *nextarc; int *info; }ArcNode; typedef struct VNode{ //头结点 VertexType data; ArcNode *firstarc; }VNode,AdjList[MAX_VERTEX_NUM]; typedef struct{ //图 AdjList vertices; int vexnum,arcnum; string kind; }ALGraph; //队列的链式存储结构P61(元素类型为整形) typedef struct QNode { int data; struct QNode *next; }QNode,*QueuePtr; typedef struct { QueuePtr front;//队头指针 QueuePt

文档评论(0)

1亿VIP精品文档

相关文档