getPathWeight method

  1. @override
double getPathWeight(
  1. Path path
)
override

Gets the weight of a specified path

Implementation

@override
double getPathWeight(Path path) {
  double pathWeight = 0;
  Queue<Vertex> pathList = path.path;

  for (int i = 0; i < pathList.length - 1; i++) {
    pathWeight +=
        getEdgeWeight(pathList.elementAt(i), pathList.elementAt(i + 1));
  }

  return pathWeight;
}