예제 #1
0
파일: load.cpp 프로젝트: renqHIT/Tale
void LoadGraph::load(bool forsaga, bool fortale)
{
	//basic indices
	//insert into Graph, Vertex and Edge tables (files on disk)
	insertGraph();
	debug(33, "insert into graph succeeds\n");
	insertNodes();
	debug(33, "insert into node succeeds\n");
	insertEdges();
	debug(33, "insert into edge succeeds\n");
//	insertOrthologs();

	if(forsaga && G->e()>0)
	{
		D=new int* [G->n()];
		for(int i=0; i<G->n(); i++)
		{
			D[i]=new int[G->n()];
		}
		//get distance matrix
		floyd_Min_Dist(G, D);
		debug(33, "got distance matrix!\n");
		
		insertDistances();
		debug(33, "insert into distance succeeds\n");
		//enumerate vertex subset and insert into fragment Table
		insertFragments();
		//deallocate 
		for(int i=0; i<G->n(); i++)
		{
			delete [] D[i];
		}
		delete [] D;
		//debug(33, "insert into fragments succeeds\n");
	}
	
	if(fortale)
	{
		//enumerate neighborhoods and insert into the Neighborhood table (file on disk)
		insertNeighborhoods();
		debug(33, "insert into neighborhoods succeeds\n");
	}
}
int main(void)
{
    int n;
    printf("How many vertices you want to take?");
    scanf("%d",&n);
    initialize(n);
    insertEdges(n);
    DFS(n);
    sortVertices(n);
    checker = 1;
    initialize(n);
    reverseDirection(n);
    for(int i = 1; i <= n; i++)
    {
        int v = s_vertices[i];

        if(color[v] == 0)
        {
            c = 0;
            DFS_Visit(n, v);
            for(int j = 1; j <= c; j++)
            {
                if(j == 1)
                {
                    printf("%d ", ver[j]);
                }
                else{

                    printf(", %d",ver[j]);
                }
            }
            printf("\n");
        }
    }


return 0;
}