Creates a new weighted edge from source to target with a weight.
const WeightedEdge(super.source, super.target, this.weight);