Serializes the object to a map.
@override Map<String, dynamic> serialize() { return {"root": root, "pathNodes": pathNodes, "index": index}; }