-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgo.h
47 lines (34 loc) · 1.31 KB
/
algo.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <deque>
#include <fstream>
#include <cstdio>
#include <utility>
#include <unordered_set>
#include <random>
#include <cassert>
#include <numeric>
#include <iostream>
#include <chrono>
#include <cstring>
using namespace std;
#define NO_VALUE -1
class SubGraph {
public:
vector<char> present;
vector<int> list;
SubGraph(const vector<vector<int>>& network);
bool insert(int vertex);
};
template <typename T>
bool contains(const vector<T>& vec, T& el);
vector<vector<int>> readPajek(string fn, vector<string>* names=nullptr);
void writePajek(string fn, vector<vector<int>> graph, vector<string> names);
vector<vector<int>> reduceToLCC(const vector<vector<int>>& network);
vector<vector<int>> distances(const vector<vector<int>>& network);
vector<int> convexGrowthTriangleIneq(const vector<vector<int>>& network, const vector<vector<int>>& distances, SubGraph& subGraph, int newVertex);
vector<int> convexGrowthTwoSearch(const vector<vector<int>>& network, SubGraph& subGraph, int newVertex);
vector<int> convexGrowth(const vector<vector<int>>& network, const vector<vector<int>>& distances, int max_steps = -1);
double cConvexity_Xc(const vector<int>& growths, int n, double c = 1.0);
double maxConvexSubsetSize_Lc(const vector<int>& growths, double c = 1.0);