I'm using intel ArBB to implement the DFS algorithm on an adjacency matrix to compare the performance with the usual c++ language, however there seems to be a problem and the algorithm is not working.
When i run it without using the call function it works fine, however when i use the call it enters an infinite loop.
This is the algorithm i implemented:
#include
#include
#define UNVISITED 0
#define VISITED 1
using namespace arbb;
using namespace std;
dense Matrix;
dense Mark;
void
DFS(i32 vertex, i32 numVertex)
{
_if (Mark[vertex] == VISITED) {
} _else {
Mark[vertex]=VISITED;
std::cout<<"v "<< std::endl;
i32 w=0;
i32 i=0;
////////////////////////// finding first neighbor
_for(i=0, i _if(Matrix(vertex,i) != 0) {
_break;
}_end_if;
}_end_for;
//////////////////////////// DFS algorithm
_for(w=i,w#if _CALL
call(DFS)(w, numVertex);
#else
DFS(w, numVertex);
#endif
_for(w=w+1, w _if(Matrix(vertex,w) != 0) {
_break;
}_end_if;
}_end_for;
}_end_for;
} _end_if
}
And here is the main:
int main()
{
i32 start=0;
i32 n=8;
Matrix = dense::dense(VERTICES,VERTICES);
Mark = dense::dense(VERTICES);
_for(i32 i=0,i {
Mark[i]=0;
_for(i32 j=0,j {
Matrix(i,j)=0;
}_end_for;
}_end_for;
//call(Matrix_Fill)(Matrix,n);
#if _CALL
call(DFS)(0, VERTICES);
#else
DFS(0, VERTICES);
#endif
return 0;
}


