Class DijkstrasAlgorithm<T>

java.lang.Object
lv.id.jc.algorithm.graph.DijkstrasAlgorithm<T>
Type Parameters:
T - the type of vertex
All Implemented Interfaces:
SearchAlgorithm<T>

public class DijkstrasAlgorithm<T> extends Object implements SearchAlgorithm<T>
Algorithm for finding the fastest paths between nodes in a graph.

The algorithm uses information about edge's distance to find the fastest path.

Since:
1.0
  • Constructor Details

    • DijkstrasAlgorithm

      public DijkstrasAlgorithm()
  • Method Details

    • findPath

      public List<T> findPath(Graph<T> graph, T source, T target)
      Description copied from interface: SearchAlgorithm
      Find the path from the source node to the target
      Specified by:
      findPath in interface SearchAlgorithm<T>
      Parameters:
      graph - The graph in which we search for the path
      source - Search starting point identifier
      target - Search finish point identifier
      Returns:
      Path found or empty list if path cannot be found