-
Notifications
You must be signed in to change notification settings - Fork 6
/
GraphUtil.h
27 lines (23 loc) · 1008 Bytes
/
GraphUtil.h
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
/* Copyright (c) Hilmi Yildirim 2010,2011.
The software is provided on an as is basis for research purposes.
There is no additional support offered, nor are the author(s)
or their institutions liable under any circumstances.
*/
#ifndef _GRAPH_UTIL_H_
#define _GRAPH_UTIL_H_
#include "Graph.h"
#include <sys/time.h>
class GraphUtil {
public:
static void dfs(Graph& g, int vid, vector<int>& preorder, vector<int>& postorder, vector<bool>& visited);
static void topo_leveler(Graph& g);
static int topo_level(Graph& g, int vid);
static void topological_sort(Graph g, vector<int>& ts);
static void tarjan(Graph& g, int vid, int& index, hash_map< int, pair<int,int> >& order, vector<int>& sn,
multimap<int, int>& sccmap, int& scc);
static void mergeSCC(Graph& g, int* on, vector<int>& ts);
static void traverse(Graph& tree, int vid, int& pre_post, vector<bool>& visited);
static void pre_post_labeling(Graph& tree);
static void genRandomGraph(int n, double c, char* filename);
};
#endif