Interface BFSVisitor


public interface BFSVisitor
A breadth first search (BFS) visitor of a graph. An implementation of this interface is provided to a BFSTraverser.
Author:
Cristian Frăsinaru
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    A back edge vu is such that u is the ancestor of v, but vu is not a tree edge.
    default void
    A cross edge connects two nodes such that they do not have any relationship between them (ancestor or descendant).
    default void
    finishVertex(SearchNode node, boolean leaf)
    Invoked after all the neighbors of the current vertex have been visited (added to the queue).
    default void
    Interrupts the traversal.
    default void
    Invoked whenever a vertex is reached for the first time as root or after a tree edge.
    default void
    A tree edge is part of the BFS tree obtained after the BFS traversal.
  • Method Details

    • startVertex

      default void startVertex(SearchNode node)
      Invoked whenever a vertex is reached for the first time as root or after a tree edge.
      Parameters:
      node - the current node.
    • finishVertex

      default void finishVertex(SearchNode node, boolean leaf)
      Invoked after all the neighbors of the current vertex have been visited (added to the queue).
      Parameters:
      node - the current node.
      leaf - true if the node is a leaf in the BFS tree.
    • treeEdge

      default void treeEdge(SearchNode from, SearchNode to)
      A tree edge is part of the BFS tree obtained after the BFS traversal.
      Parameters:
      from - a node in the BFS tree.
      to - a node in the BFS tree.
    • backEdge

      default void backEdge(SearchNode from, SearchNode to)
      A back edge vu is such that u is the ancestor of v, but vu is not a tree edge. Back edges are specific to directed graphs.
      Parameters:
      from - a node in the BFS tree.
      to - a node in the BFS tree.
    • crossEdge

      default void crossEdge(SearchNode from, SearchNode to)
      A cross edge connects two nodes such that they do not have any relationship between them (ancestor or descendant).
      Parameters:
      from - a node in the BFS tree.
      to - a node in the BFS tree.
    • interrupt

      default void interrupt()
      Interrupts the traversal.