1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| #include <cstdio>
#define MAXVEX 100 #define INFINITY 65535
typedef char VertexType; typedef int EdgeType; typedef int InforType;
typedef struct Graph{ VertexType vexs[MAXVEX]; EdgeType arc[MAXVEX][MAXVEX]; int numVertexes, numEdge; }Graph;
typedef struct EdgeNode { int adjvex; EdgeType weight; struct EdgeNode *next; }EdgeNode;
typedef struct VertexNode { VertexType data; EdgeNode *firstdege; }VertexNode;
typedef struct GraphAdjlist { VertexNode adjlist[MAXVEX]; int numVertex, numEdge; }GraphAdjlist;
typedef struct ArcNode{ int tailvex, headvex; struct AcrNode *hlink, *tlink; InforType *infor; }ArcNode;
typedef struct VexNode{ VertexType data; ArcNode *firstin, *firstout; }VexNode;
typedef struct OLGraph{ VexNode xlist[MAXVEX]; int numVertex, numEdge; }OLGraph;
typedef struct Edgenode{ int ivex, jvex; int mark; struct Arcnode *ilink, *jlink; InforType *infor; }Edgenode;
typedef struct Vexnode{ VertexType data; Edgenode *firstedge; }Vexnode;
typedef struct AMLGraph{ Vexnode adjlist[MAXVEX]; int numvex, numedge; }AMLGraph;
|