tree consTree( element e, tree leftTree, tree rightTree )
{

    tree root = EMPTYTREE;

    /* If there's no left and right three, make a new tree.  */
    if ( emptyTree( leftTree ) && emptyTree( rightTree ) ) {
        /* After this call a new graph will be initialized.  */
        root =
            newVertex( e, globalPointerToVertexHead,
                       globalPointerToEdgeHead );

    } else if ( emptyTree( rightTree ) ) {
        root =
            newVertex( e, globalPointerToVertexHead,
                       globalPointerToEdgeHead );
        connectVertex( globalPointerToEdgeHead, root, leftTree, 'l' );

    } else if ( emptyTree( leftTree ) ) {
        root =
            newVertex( e, globalPointerToVertexHead,
                       globalPointerToEdgeHead );
        connectVertex( globalPointerToEdgeHead, root, rightTree, 'r' );
    }
    /* otherwise make new vertex as root and two trees as son  */
    else {
        root =
            newVertex( e, globalPointerToVertexHead,
                       globalPointerToEdgeHead );
        connectVertex( globalPointerToEdgeHead, root, leftTree, 'l' );
        connectVertex( globalPointerToEdgeHead, root, rightTree, 'r' );
    }

    return root;
}
Exemple #2
0
	void process(const SSSPEdge & edge) {
		connectVertex(edge);
	}
Exemple #3
0
		void process(const std::pair<CmiUInt8, BFSEdge > & edge) {
			connectVertex(edge);
		}
Exemple #4
0
	void process(const PageRankEdge & edge) {
		connectVertex(edge);
	}
	void process(const BFSEdge & edge) {
		connectVertex(edge);
	}