Data Structures | Functions

sst/elements/genericProc/programs/MTGL/test/test_static_graph3.cpp File Reference

This test program compares MTA performance of various traversals of a C compressed sparse row graph representation. More...

#include <cstdlib>
#include <mtgl/static_graph_adapter.hpp>
#include <mtgl/generate_rmat_graph.hpp>
#include <mtgl/breadth_first_search_mtgl.hpp>
#include <mtgl/visit_adj.hpp>

Data Structures

class  in_degree_adj_visitor< graph >
class  in_degree_adj_visitor2< graph >

Functions

template<typename Graph >
void compute_in_degree (Graph *g, unsigned long *in_degree)
template<typename Graph >
void compute_in_degree2 (Graph *g, unsigned long *in_degree)
template<typename Graph >
unsigned long * compute_in_degree3 (Graph *g)
template<typename graph_adapter >
void compute_in_degree_adapter (graph_adapter &g, typename graph_traits< graph_adapter >::size_type *in_degree)
int main (int argc, char *argv[])

Detailed Description

This test program compares MTA performance of various traversals of a C compressed sparse row graph representation.

This shows how to use the load-balanced "visit_adj" function to efficiently traverse the adjaceny lists of vertices in a power-law graph.

Author:
Jon Berry (jberry@sandia.gov)
Date:
1/28/2008

The representation stores out-edges, and our sample task is to compute the in-degree of each vertex by traversing the adjacency structure and therefore touching all of the graph.

Unfortunately, this isn't a compelling teaching example since we could compute the information with traversing adjacency lists for this structure. We'll proceed anyway, as touching the whole graph is involved in lots of ranking algorithms.

Author:
Jon Berry (jberry@sandia.gov)
Date:
8/15/2009

It is compared to an optimal C implmentation that achieves the compiler's "loop merge." We dont't expect anything to be able to beat that C implementation.

However, note that the latter is very inflexible. Adding any nontrivial code to the inner loop body tends to defeat the compiler's loop merge. The consequences of this are demonstrated in test_static_graph6.cpp.