Fixed visualization and added weight attribute to merged edges to prevent loss of information