分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow
本博客前面文章已对图有过简单的介绍,本文主要是重点介绍有关图的一些具体操作与应用
阅读本文前,可以先参考本博客 各种基本算法实现小结(四)—— 图及其遍历 和 图的一些基本算法
无向图——邻接矩阵的深度优先和广度优先算法实现
测试环境:VS2008(C)
#include "stdafx.h"#include <stdlib.h>#include <malloc.h>#define INFINITY INT_MAX#define MAX_VEX 20#define VRType int#define VertexType char#define InfoType intint *visited;/********************************//**** 图的结构定义 ****//********************************/typedef enum{ DG, DN, UDG, UDN}GraphKind;struct _ArcCell{ VRType adj; /* note weight */ InfoType *info;};typedef struct _ArcCell ArcCell, AdjMatrix[MAX_VEX][MAX_VEX];struct _MGraph{ VertexType vexs[MAX_VEX]; AdjMatrix arcs; int vexnum, arcnum; GraphKind kind;};typedef struct _MG