forked from jlothian/INDDGO-survey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jlothian#24 from spowers/master
expansion; doubles; graph stats
- Loading branch information
Showing
7 changed files
with
138 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
This file is part of INDDGO. | ||
Copyright (C) 2012, Oak Ridge National Laboratory | ||
This product includes software produced by UT-Battelle, LLC under Contract No. | ||
DE-AC05-00OR22725 with the Department of Energy. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the New BSD 3-clause software license (LICENSE). | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
LICENSE for more details. | ||
For more information please contact the INDDGO developers at: | ||
[email protected] | ||
*/ | ||
|
||
#include "GraphReader.h" | ||
#include "GraphProperties.h" | ||
#include <ctime> | ||
|
||
using namespace std; | ||
|
||
void usage(const char *s){ | ||
fprintf(stderr, "Usage: %s filename\n", s); | ||
} | ||
|
||
int main(int argc, char **argv){ | ||
//usage check | ||
if((argc == 1) || | ||
((argc == 2) && (strcmp(argv[1],"-h") == 0)) || | ||
((argc == 2) && (strcmp(argv[1], "--help") == 0))){ | ||
usage(argv[0]); | ||
exit(-1); | ||
} | ||
|
||
Graph::Graph *g; | ||
|
||
clock_t begin, end; | ||
|
||
Graph::GraphProperties prop; | ||
Graph::GraphReader ngr; | ||
|
||
//create the graph object | ||
g = new Graph::Graph(); | ||
|
||
//read the graph from the filename, assume it is an edgelist | ||
ngr.read_graph(g, argv[1], "Edge", false); | ||
//ngr.read_graph(g, argv[1], "ADJLIST", false); | ||
printf("Read %d vertices and %d edges\n", g->get_num_nodes(), g->get_num_edges()); | ||
|
||
printf("Simplifying graph\n"); | ||
begin = clock(); | ||
prop.make_simple(g); //remove self loops and duplicate edges | ||
end = clock(); | ||
printf("Time: %f\n", double(end - begin) / CLOCKS_PER_SEC); | ||
|
||
//compute normalized expansion | ||
begin = clock(); | ||
vector<double> norm_hops; | ||
prop.expansion(g, norm_hops); | ||
end = clock(); | ||
printf("Alg Time (expansion): %f\n", double(end - begin) / CLOCKS_PER_SEC); | ||
} // main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters