Skip to content

Commit

Permalink
cassovary support
Browse files Browse the repository at this point in the history
  • Loading branch information
Aapo Kyrola committed Sep 11, 2012
1 parent b191b32 commit 1557d4c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
26 changes: 21 additions & 5 deletions example_apps/convert_to_adjacency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ typedef bool EdgeDataType;

FILE * f;

#define MODE_ADJLIST 0
#define MODE_CASSOVARY_ADJ 1

int mode;

struct AdjConverter : public GraphChiProgram<VertexDataType, EdgeDataType> {


Expand All @@ -49,10 +54,21 @@ struct AdjConverter : public GraphChiProgram<VertexDataType, EdgeDataType> {
*/
void update(graphchi_vertex<VertexDataType, EdgeDataType> &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; i<vertex.num_outedges(); i++)
fprintf(f, " %d", vertex.outedge(i)->vertex_id());
fprintf(f, "\n");
switch(mode) {
case MODE_ADJLIST: {
fprintf(f, "%d %d", vertex.id(), vertex.num_outedges());
for(int i=0; i<vertex.num_outedges(); i++)
fprintf(f, " %d", vertex.outedge(i)->vertex_id());
fprintf(f, "\n");
break;
}
case MODE_CASSOVARY_ADJ: {
fprintf(f, "%d %d\n", vertex.id(), vertex.num_outedges());
for(int i=0; i<vertex.num_outedges(); i++)
fprintf(f, "%d\n", vertex.outedge(i)->vertex_id());
break;
}
}
}

/**
Expand Down Expand Up @@ -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<EdgeDataType>(filename,
get_option_string("nshards", "auto"));

mode = get_option_int("mode", 0);
std::string outfile = filename + ".adj";
f = fopen(outfile.c_str(), "w");

Expand Down
10 changes: 10 additions & 0 deletions graphchi_xcode/graphchi_xcode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
5FCC23FE15A2395B0003D0E9 /* als_vertices_inmem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = als_vertices_inmem.cpp; sourceTree = "<group>"; };
5FCC242B15A378DC0003D0E9 /* streaming_pagerank.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = streaming_pagerank.cpp; sourceTree = "<group>"; };
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 = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -795,6 +796,7 @@
5FCC1EBC1599F59A0003D0E9 /* example_apps */ = {
isa = PBXGroup;
children = (
5FE6102515FFE24E007BB5B7 /* util */,
5FCC1EC8159A03D50003D0E9 /* matrix_factorization */,
5FCC1EBD1599F59A0003D0E9 /* application_template.cpp */,
5FCC1EBE1599F59A0003D0E9 /* communitydetection.cpp */,
Expand Down Expand Up @@ -848,6 +850,14 @@
path = graphlab2_1_GAS_api;
sourceTree = "<group>";
};
5FE6102515FFE24E007BB5B7 /* util */ = {
isa = PBXGroup;
children = (
5FE6102615FFE270007BB5B7 /* convert_to_adjacency.cpp */,
);
name = util;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down

0 comments on commit 1557d4c

Please sign in to comment.