added code for creation of junction tree