added a weight field to Edge class (set using alternative constructor, maintaining backwards compatibility)