# Constructing undirected graph and depth first traversal connected graph (adjacency matrix recursion)

Time：2021-12-31
``````#include <iostream>
using namespace std;
#define MVNum 100
typedef char VerTexType;
typedef int ArcType;
typedef struct{
VerTexType vexs[MVNum];
ArcType arcs[MVNum][MVNum];
int vexnum,arcnum;
}Graph;
bool visited[MVNum];
int LocateVex(Graph G , VerTexType v){
for(int i = 0; i < G.vexnum; ++i)
if(G.vexs[i] == v)
return i;
return -1;
}
//Create undirected graph
void CreateUDG(Graph &G){
int i , j , k;
Cout < < "total vertices, total edges:";
cin >> G.vexnum >> G.arcnum;
for(i = 0; i < G.vexnum; ++i){
Cout < < "the first" < < < (I + 1) < < "point name:";
cin >> G.vexs[i];
}
for(i = 0; i < G.vexnum; ++i)
for(j = 0; j < G.vexnum; ++j)
G.arcs[i][j] = 0;
for(k = 0; k < G.arcnum;++k){
VerTexType v1 , v2;
Cout < < "th" < < < (K + 1) < < "vertex to which the edge is attached:";
cin >> v1 >> v2;
i = LocateVex(G, v1);  j = LocateVex(G, v2);
G.arcs[j][i] = G.arcs[i][j] = 1;
}
}
//Depth first traversal
void DFS(Graph G, int v){
int w;
cout << G.vexs[v];  visited[v] = true;
for(w = 0; w < G.vexnum; w++)
if((G.arcs[v][w] != 0)&& (!visited[w]))  DFS(G, w);
}
int main(){
Graph G;
CreateUDG(G);
Cout < < "start point of traversing undirected graph:";
VerTexType c;
cin >> c;
int i;
for(i = 0 ; i < G.vexnum ; ++i){
if(c == G.vexs[i])
break;
}
Cout < < "depth first traversal undirected graph:";
DFS(G , i);
return 0;
}``````

## [go web development] configure database connection pool

In this section, we will explain how connection pooling works behind it and explore how configuring a database can change or optimize its performance. Note: the database series contains quite a few theories, which are interesting but not important to the construction of applications. If you find it too difficult, you can browse it first […]