本文讲解基于C#实现图的广度优先搜索BFS算法 1、程序 namespace 图的存储结构 { using VertexType = System.Char;//顶点数据类型别名声明 using EdgeType = System.Int16;//带权图中边上权值的数据类型别名声明 class Program { public const int MAxVertexNum = 100;//顶点数目的最大值 public const int MAXSize = 100; static void Main(string[] args) { MGraph G = new MGraph();
G.vexnum = 8;
G.arcnum = 8;
G.vex = new VertexType[MAxVertexNum];
G.Edge = new EdgeType[MAxVertexNum, MAxVertexNum] ;
for (int i=0;i< MAxVertexNum;++i) {
for (int j=0;j
关注
打赏