Beispiel #1
0
int TreeWidth(NodeTree* ApT, level l) {
    if(ApT == NULL) {
        return 0;
    }
    else {
        if(l == 1) {
            return 1;
        }
        else {
            return TreeWidth(ApT->left, l-1) + TreeWidth(ApT->right, l-1);
        }
    }
}
Beispiel #2
0
int maxTreeWidth(NodeTree* ApT) {
    int i, width, max_width = -1;

    for(i = 1; i <= TreeWeight(ApT); i++) {
        width = TreeWidth(ApT, i);

        if(width > max_width) {
            max_width = width;
        }
    }

    return max_width;
}
Beispiel #3
0
void output()
{
	
	int tw = -1;

    //clock_t t = clock();
    tw = TreeWidth(EliminateOrder);
	//printf("zdz %ld\n", clock()-t);
	
	printf("The graph's tree width is: %d\n", tw);

	PrintEliminateOrder(EliminateOrder);

}