# 圖
## 圖的基本術語
## 圖的存儲結構
### 鄰接矩陣
```c++
// 鄰接矩陣適用于頂點數較小的情況(例如<1000)
// 有向圖鄰接矩陣的graph[i][j] 表示第i個節點指向第j個節點的邊的權重
// 無向圖鄰接矩陣的graph[i][j] 表示連接第i個節點和第j個節點的邊的權重
// 無向圖鄰接矩陣是對稱陣
int graph[maxN][maxN];
```
### 鄰接表
```c++
// 無權重的圖
vector<int> Adj[maxN];
// 有權重的圖
struct Node{
int v,w;
Node(int _v, int _w): v(_v), w(_w) {}
};
vector<Node> Adj[maxN];
```
## 圖的基本算法實現