28 lines
799 B
C
28 lines
799 B
C
#ifndef MY_GRAPH
|
|
#define MY_GRAPH
|
|
|
|
#include "my_structures.h"
|
|
#include "my_util.h"
|
|
#include "my_operator.h"
|
|
|
|
|
|
// take an adjacency matrix and return a vector of verteces O(V ^^ 2)
|
|
Graph mat2list(Matrix& adj_matrix);
|
|
// from list of adjacency list to a adjecency matrix 0(V + E)
|
|
Matrix list2mat(Graph& adj_list);
|
|
|
|
// generate an oriented adj matrix
|
|
Matrix generate_mat(float prob, int dim, bool oriented = true, int max_weight = 1);
|
|
|
|
vector<bfs_vertex> BFS(Graph& list, size_t src);
|
|
vector<bfs_vertex> BFS(Matrix& mat, int src);
|
|
|
|
|
|
bool sametree(vector<dfs_vertex>& dfs_vec, int start);
|
|
void DFS_visit(Graph& G, vector<dfs_vertex>& dfs_vec, vector<vector<eStatus>>& stat, int& time, int index);
|
|
vector<dfs_vertex> DFS(Graph& G, int src = 0);
|
|
vector<dfs_vertex> DFS(Matrix& mat, int src = 0);
|
|
|
|
#endif
|
|
|