annotate louvain/graph.h @ 0:1d1b9e1b2e2f draft

Uploaded
author petr-novak
date Thu, 19 Dec 2019 10:24:45 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
1 // File: graph.h
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
2 // -- simple graph handling header file
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
3 //-----------------------------------------------------------------------------
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
4 // Community detection
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
5 // Based on the article "Fast unfolding of community hierarchies in large networks"
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
6 // Copyright (C) 2008 V. Blondel, J.-L. Guillaume, R. Lambiotte, E. Lefebvre
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
7 //
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
8 // This program must not be distributed without agreement of the above mentionned authors.
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
9 //-----------------------------------------------------------------------------
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
10 // Author : E. Lefebvre, adapted by J.-L. Guillaume
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
11 // Email : jean-loup.guillaume@lip6.fr
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
12 // Location : Paris, France
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
13 // Time : February 2008
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
14 //-----------------------------------------------------------------------------
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
15 // see readme.txt for more details
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
16
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
17 #ifndef GRAPH_H
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
18 #define GRAPH_H
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
19
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
20 #include <stdlib.h>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
21 #include <stdio.h>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
22 #include <iostream>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
23 #include <iomanip>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
24 #include <fstream>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
25 #include <vector>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
26 #include <map>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
27 #include <set>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
28 #include <algorithm>
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
29
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
30 #define WEIGHTED 0
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
31 #define UNWEIGHTED 1
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
32
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
33 using namespace std;
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
34
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
35 class Graph {
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
36 public:
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
37 vector<vector<pair<int,float> > > links;
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
38
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
39 Graph (char *filename, int type);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
40
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
41 void clean(int type);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
42 void renumber(int type);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
43 void display(int type);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
44 void display_binary(char *filename, char *filename_w, int type);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
45 };
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
46
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
47 #endif // GRAPH_H