/* 用图邻接矩阵表示实现的一些基本运算*/
#define MAXVEX 20
#define null -1
typedef char VexType;
typedef float AdjType;
typedef struct
{ VexType vexs[MAXVEX]; /* 顶点信息 */
AdjType arcs[MAXVEX][MAXVEX]; /* 边信息 */
int n; /* 图的顶点个数 */
}GraphMatrix;
int firstVertex(GraphMatrix* pgraph)
{
return null;
else return 0;
}
int nextVertex(GraphMatrix* pgraph,int n)
{
if(n==pgraph->n-1)
return null;
else return n+1;
}
int firstAdjacent(GraphMatrix* pgraph,int i)
{ int k;
for(k=0;k<pgraph->n;k++)
if(pgraph->arcs[i][k]!=0) return k;
return null;
}
int nextAdjacent(GraphMatrix* pgraph,int i,int j)
{ int k;
for(k=j+1; k<pgraph->n; k++)
if(pgraph->arcs[i][k]!=0) return k;
return null;
}
int main(){return 0;}