Ejemplo n.º 1
0
void preorderDotDump (node root, FILE* outputFile)
{
    if (root != NULL)
    {
        fprintf (outputFile, "%d [label=%d,color=black];\n",root->data, root->data);
        if (root->llink != NULL)
            fprintf (outputFile, "%d -> %d ;\n", root->data, (root->llink)->data);

        if (root->rlink != NULL)
            fprintf (outputFile, "%d -> %d;\n", root->data, root->rlink->data);
        preorderDotDump (root->rlink, outputFile);
        preorderDotDump (root->llink, outputFile);
    }
}
Ejemplo n.º 2
0
void preorderDotDump (NODE R, FILE* outputFile)
{
	if (R != NULL) 
	{
		fprintf (outputFile, "%d [label=%d,color=black];\n",R->key, R->key);
		if (R->left != NULL) 
		         fprintf (outputFile, "%d -> %d ;\n", R->key, (R->left)->key);
		
        	if (R->right != NULL)
            		fprintf (outputFile, "%d -> %d;\n", R->key, (R->right)->key);
        	preorderDotDump (R->right, outputFile);
        	preorderDotDump (R->left, outputFile);
    	}
}
Ejemplo n.º 3
0
void dotDump(node root, FILE *outFile)
{
    gName++;
    fprintf (outFile, "digraph BST {\n",gName);
    preorderDotDump (root, outFile);
    fprintf (outFile, "}\n");
}
Ejemplo n.º 4
0
void dotDump(NODE R, FILE *outFile)
{
	gName++;
	fprintf (outFile, "digraph BST {\n",gName);
	preorderDotDump (R, outFile);
    	fprintf (outFile, "}\n");
}
Ejemplo n.º 5
0
void preorderDotDump (NODE R, FILE* outputFile)
{
	if (R != NULL) 
	{
		fprintf (outputFile, "%d [label=%d,color=black];\n",R->info, R->info);
		if (R->llink != NULL) 
		         fprintf (outputFile, "%d -> %d ;\n", R->info, (R->llink)->info);
        	if (R->rchild != NULL) {
            		fprintf (outputFile, "%d -> %d [style=dashed,color=red];\n", R->info, (R->rchild)->info);
            		fprintf(outputFile, "%d [shape=rect];\n",(R->rchild)->info);
            	}
        	preorderDotDump (R->llink, outputFile);
        	if(R->rchild!=NULL) {
        		preorderDotDump (R->rchild, outputFile);
        		R=R->rchild;
        	}
    	}
}