1. Adjacency matrix method: The so-called adjacency matrix storage is to use a one-dimensional array to store the vertex information in the graph, a two-dimensional array to store the edge information in the graph (that is, the adjacency relationship between vertices), and to store the vertices The two-dimensional array of adjacency relations is called the adjacency matrix.
The graph’s adjacency matrix storage structure is defined as follows:
#define MaxVertexNum 100 //Maximum number of vertices
Typedef char VertexType; //Vertex data type
Typedef int EdgeType; // Data type with weights on edges in the
graph Typedef struct{ VertexType Vex[MaxVertexNum]; //Vertex Table EdgeType Edge[MaxVertexNum][MaxVertexNum]; //Adjacency Matrix, Edge Table Int vexnum,arcnum; //The current number of vertices and arcs of the graph }MGraph;