forked from aaronmcdaid/MaximalCliques
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustTheCliques.cpp
47 lines (38 loc) · 1.41 KB
/
justTheCliques.cpp
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
using namespace std;
#include "graph/network.hpp"
#include "graph/loading.hpp"
#include "graph/stats.hpp"
#include <getopt.h>
#include <libgen.h>
#include <ctime>
#include "macros.hpp"
#include "cliques.hpp"
#include "cmdline.h"
int option_minCliqueSize = 3;
int main(int argc, char **argv) {
gengetopt_args_info args_info;
// there shouldn't be any errors in processing args
if (cmdline_parser (argc, argv, &args_info) != 0)
exit(1) ;
// .. and there should be exactly one non-option arg
if(args_info.inputs_num != 1 || args_info.k_arg < 3) {
cmdline_parser_print_help();
exit(1);
}
const char * edgeListFileName = args_info.inputs[0];
const int k = args_info.k_arg;
std :: auto_ptr<graph :: NetworkInterfaceConvertedToString > network;
if(args_info.stringIDs_flag) {
network = graph :: loading :: make_Network_from_edge_list_string(edgeListFileName, false, false, true);
} else {
network = graph :: loading :: make_Network_from_edge_list_int64(edgeListFileName, false, false, true, 0);
}
int32_t maxDegree = graph :: stats :: get_max_degree(network->get_plain_graph());
cerr << "Network loaded"
<< " after " << (double(clock()) / CLOCKS_PER_SEC) << " seconds. "
<< network.get()->numNodes() << " nodes and " << network.get()->numRels() << " edges."
<< " Max degree is " << maxDegree
<< endl;
// cliques::cliquesToStdout(g.get(), k);
cliques :: cliquesToStdout(network.get(), k);
}