-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeightGraph.h
50 lines (40 loc) · 1011 Bytes
/
WeightGraph.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
47
48
49
#include<iostream>
#include<fstream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<cstdlib>
#include<algorithm>
using namespace std;
#ifndef LabelPropgation_h_h
#define LabelPropgation_h_h
class weightGraph
{
public:
int totalnodes;
int totallinks;
vector<string> Nodenames;
vector<vector<int> > Neighbors;
map<pair<int,int>,double> Linklist;
vector<set<int> > node_links;
public:
weightGraph();
~weightGraph();
void loading(string &inputFileName);
int node_degree(int nodeNum);
pair<pair<int,int>,double> GetLink(int edgeNum);
int find_offset(string nodename);
int GetVcount(){return totalnodes;}
int GetEcount(){return totallinks;}
bool isConnect(int node1,int node2)
{
if (find(Neighbors[node1].begin(),Neighbors[node1].end(),node2)!=Neighbors[node1].end())
return true;
else
return false;
}
void nodeTolinks();
};
#endif // LOADINGGRAPH_H_H