added some function to the wrapper c interface and fixed a bug to update the weighted degrees of merged nodes as well