Added comments and moved the weight calcuations into the edge constructor.