getEdgeWeight method

  1. @override
double getEdgeWeight(
  1. Vertex a,
  2. Vertex b
)
override

A Method to get the weight of an edge. Because the graph has directional nodes you need to specify a starting node a and an ending node b. Because this is a directed graph a and b are NOT interchangeable.

Implementation

@override
double getEdgeWeight(Vertex a, Vertex b) => graph[getVertex(a)]!
    .firstWhere((element) => element.b.equalsById(b))
    .weight;