getNeighboringEdgesOfEdge method

  1. @override
List<UndirectedEdge> getNeighboringEdgesOfEdge(
  1. Edge edge
)
override

Gets all neighboring edges of an edge

Implementation

@override
List<UndirectedEdge> getNeighboringEdgesOfEdge(Edge edge) {
  List<UndirectedEdge> found = [];
  getOutgoingEdges(edge.a).forEach((element) {
    found.add(element);
  });

  getOutgoingEdges(edge.b).forEach((element) {
    if (element.b != edge.a) {
      found.add(element);
    }
  });

  // Remove the edge itself
  found.remove(edge);
  found.remove(UndirectedEdge(edge.b, edge.a, edge.weight));

  return found;
}