-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.cpp
More file actions
31 lines (25 loc) · 711 Bytes
/
Graph.cpp
File metadata and controls
31 lines (25 loc) · 711 Bytes
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
/* C style array vector
*
* - has length V
* - each position is a empty std::vector<int>
*/
std::vector<int> adj[V];
/* Vector of vectors
*
* - mutable structure, can always be increased in length or depth
* - most used
*/
std::vector<vector<int> > adj;
/* Adjacency Matrix
*
* - Occupies too much space
* - Has indexes that are not used
* - (int)
* - has 0 where there is no connection from row to column
* - has 1 where there is connection from row to column
* - (bool)
* - has false where there is no connection from row to column
* - has true where there is connection from row to column
*/
int adjMatrix[rows][columns];
bool adjMatrix[rows][columns];