diff --git a/example_apps/convert_to_adjacency.cpp b/example_apps/convert_to_adjacency.cpp index 93fe95ee..4eccd8eb 100644 --- a/example_apps/convert_to_adjacency.cpp +++ b/example_apps/convert_to_adjacency.cpp @@ -41,6 +41,11 @@ typedef bool EdgeDataType; FILE * f; +#define MODE_ADJLIST 0 +#define MODE_CASSOVARY_ADJ 1 + +int mode; + struct AdjConverter : public GraphChiProgram { @@ -49,10 +54,21 @@ struct AdjConverter : public GraphChiProgram { */ void update(graphchi_vertex &vertex, graphchi_context &gcontext) { if (vertex.id() % 10000 == 0) std::cout << vertex.id() << std::endl; - fprintf(f, "%d %d", vertex.id(), vertex.num_outedges()); - for(int i=0; ivertex_id()); - fprintf(f, "\n"); + switch(mode) { + case MODE_ADJLIST: { + fprintf(f, "%d %d", vertex.id(), vertex.num_outedges()); + for(int i=0; ivertex_id()); + fprintf(f, "\n"); + break; + } + case MODE_CASSOVARY_ADJ: { + fprintf(f, "%d %d\n", vertex.id(), vertex.num_outedges()); + for(int i=0; ivertex_id()); + break; + } + } } /** @@ -96,7 +112,7 @@ int main(int argc, const char ** argv) { /* Detect the number of shards or preprocess an input to create them */ int nshards = convert_if_notexists(filename, get_option_string("nshards", "auto")); - + mode = get_option_int("mode", 0); std::string outfile = filename + ".adj"; f = fopen(outfile.c_str(), "w"); diff --git a/graphchi_xcode/graphchi_xcode.xcodeproj/project.pbxproj b/graphchi_xcode/graphchi_xcode.xcodeproj/project.pbxproj index 261b8ee1..2aba5651 100644 --- a/graphchi_xcode/graphchi_xcode.xcodeproj/project.pbxproj +++ b/graphchi_xcode/graphchi_xcode.xcodeproj/project.pbxproj @@ -296,6 +296,7 @@ 5FCC23FE15A2395B0003D0E9 /* als_vertices_inmem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = als_vertices_inmem.cpp; sourceTree = ""; }; 5FCC242B15A378DC0003D0E9 /* streaming_pagerank.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = streaming_pagerank.cpp; sourceTree = ""; }; 5FCC243415A378E70003D0E9 /* streaming_pagerank */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = streaming_pagerank; sourceTree = BUILT_PRODUCTS_DIR; }; + 5FE6102615FFE270007BB5B7 /* convert_to_adjacency.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = convert_to_adjacency.cpp; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -795,6 +796,7 @@ 5FCC1EBC1599F59A0003D0E9 /* example_apps */ = { isa = PBXGroup; children = ( + 5FE6102515FFE24E007BB5B7 /* util */, 5FCC1EC8159A03D50003D0E9 /* matrix_factorization */, 5FCC1EBD1599F59A0003D0E9 /* application_template.cpp */, 5FCC1EBE1599F59A0003D0E9 /* communitydetection.cpp */, @@ -848,6 +850,14 @@ path = graphlab2_1_GAS_api; sourceTree = ""; }; + 5FE6102515FFE24E007BB5B7 /* util */ = { + isa = PBXGroup; + children = ( + 5FE6102615FFE270007BB5B7 /* convert_to_adjacency.cpp */, + ); + name = util; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */