Adds edge weight functionality.