IBIA: An Incremental Build-Infer-Approximate Framework for Approximate Inference of Partition Function