34
34
#include "igraph.h"
35
35
#include "graphpass.h"
36
36
37
+ char * FILEPATH ; /**< The filepath (DIRECTORY + FILENAME) */
38
+
39
+ /** Whether to save the graph **/
37
40
bool SAVE = true;
41
+ /** Graph format true for GEXF; false for GRAPHML **/
38
42
bool GFORMAT = false;
43
+ /** Produce a report analyzing effect of filtering on graph **/
39
44
bool REPORT = false;
45
+ /** Provide a quickrun with simple sizing, positioning and coloring **/
40
46
bool QUICKRUN = false;
41
47
42
48
int verbose_flag ;
43
49
44
50
int main (int argc , char * argv []) {
45
- /* Experiments here */
46
- printf ("test\n\n" );
47
- igraph_vector_t test , test2 ;
48
- igraph_vector_init (& test , 10 );
49
- igraph_vector_init (& test2 , 10 );
50
- VECTOR (test )[0 ] = 10 ; VECTOR (test )[1 ] = 2 ;
51
- VECTOR (test )[2 ] = 4 ; VECTOR (test )[3 ] = 7 ;
52
- VECTOR (test )[4 ] = 10 ; VECTOR (test )[5 ] = 100 ;
53
- VECTOR (test )[6 ] = 11 ; VECTOR (test )[7 ] = 99 ;
54
- VECTOR (test )[8 ] = 2 ; VECTOR (test )[9 ] = 10 ;
55
- produceRank (& test , & test2 );
56
- printf ("%f\n" , VECTOR (test2 )[5 ]);
57
- printf ("%f\n" , VECTOR (test2 )[9 ]);
58
-
59
-
60
- /* End experiments */
61
-
51
+ /* Experiments here
52
+
53
+ End experiments */
62
54
63
55
int c ;
64
56
while (1 )
@@ -149,35 +141,45 @@ int main (int argc, char *argv[]) {
149
141
printf ("%s " , argv [optind ++ ]);
150
142
putchar ('\n' );
151
143
}
144
+
145
+ /** set default values if not included in flags **/
152
146
OUTPUT = OUTPUT ? OUTPUT : "OUT/" ;
153
147
PERCENT = PERCENT ? PERCENT : 0.00 ;
154
148
METHODS = METHODS ? METHODS : "d" ;
155
149
DIRECTORY = DIRECTORY ? DIRECTORY : "assets/" ;
156
150
FILENAME = FILENAME ? FILENAME : "cpp2.graphml" ;
151
+
152
+ /** setup directory path DIRECTORY + FILENAME **/
157
153
char path [strlen (DIRECTORY )+ 1 ];
158
154
strncpy (path , DIRECTORY , strlen (DIRECTORY )+ 1 );
155
+
156
+ /** start output description **/
159
157
printf (">>>>>>> GRAPHPASSING >>>>>>>> \n" );
160
158
printf ("DIRECTORY: %s \nSTRLEN PATH: %li \n" , DIRECTORY , strlen (path ));
161
159
printf ("OUTPUT DIRECTORY: %s\nPERCENTAGE: %f\n" , OUTPUT , PERCENT );
162
160
printf ("FILE: %s\nMETHODS STRING: %s\n" , FILENAME , METHODS );
163
161
printf ("QUICKRUN: %i\nREPORT: %i\nSAVE: %i\n" , QUICKRUN , REPORT , SAVE );
162
+
163
+ /** try to be nice if user leaves out a '/' **/
164
164
if (FILENAME [0 ] == '/' && DIRECTORY [strlen (DIRECTORY )] == '/' ){
165
- printf ("Removing redundant slashes from filename.\n" );
166
- path [strlen (path )+ 1 ] = '\0' ;
165
+ path [strlen (path )+ 1 ] = '\0' ; // remove end slash
167
166
}
168
167
else if (FILENAME [0 ] != '/' && DIRECTORY [strlen (DIRECTORY )- 1 ] != '/' ) {
169
- printf ("Adding slash separator.\n" );
170
- strncat (path , "/" , 1 );
171
- printf ("Current path: %s.\n" , path );
168
+ strncat (path , "/" , 1 ); // add a slash.
172
169
}
170
+
171
+ /** set up FILEPATH to access graphml file **/
173
172
int sizeOfPath = (strlen (path )+ 1 );
174
173
int sizeOfFile = (strlen (FILENAME )+ 1 );
175
174
int filepathsize = sizeOfPath + sizeOfFile ;
176
-
177
175
FILEPATH = malloc (filepathsize + 1 );
178
176
snprintf (FILEPATH , filepathsize , "%s%s" , path , FILENAME );
179
177
printf ("Running graphpass on file: %s\n" , FILEPATH );
178
+
179
+ /** load the graphml **/
180
180
load_graph (FILEPATH );
181
+ free (FILEPATH );
182
+ /** start the filtering based on values and methods **/
181
183
filter_graph ();
182
184
printf ("\n\n>>>> SUCCESS!" );
183
185
if (SAVE ) {
@@ -186,6 +188,6 @@ int main (int argc, char *argv[]) {
186
188
else {
187
189
printf ("- NO_SAVE requested, so no output.\n\n\n" );
188
190
}
189
- free ( FILEPATH );
191
+
190
192
return 0 ;
191
193
}
0 commit comments