getEdge method

  1. @override
Edge getEdge(
  1. Vertex a,
  2. Vertex b
)
override

Returns an Edge in a graph with Vertex a and b

Implementation

@override
Edge getEdge(Vertex a, Vertex b) {
  UndirectedEdge foundEdge;
  if (graph[a]!.any((element) => element.b.equalsById(b))) {
    foundEdge = graph[a]!.firstWhere((element) => element.b.equalsById(b))
        as UndirectedEdge;
  } else {
    foundEdge = graph[b]!.firstWhere((element) => element.a.equalsById(a))
        as UndirectedEdge;
  }
  return foundEdge;
}