图的基本数据结构,表头节点和边表节点
code:
#include<iostream>
using namespace std;
#define MAXV 100
typedef struct Arcnode {
int data;
struct Arcnode *nextArc;
}ArcNode;
typedef struct Anode
{
int adj;
ArcNode *firstArc;
}ANode;
typedef Anode adjARC[MAXV];
typedef struct MGraph
{
adjARC adjArc;
int e, n;
};
typedef struct Matx {
int n, e;
int edge[5][5];
};
void CreatMatx(Matx *&mat) {
cout << "e =:>>";
cin >> mat->e;
cout << " n = :>>";
cin >> mat->n;
memset(mat->edge, 0, sizeof mat->edge);
char ch = 'go';
while (ch != 'q')