import java.util.List; import graphlib.graphs.DirectedGraph; import graphlib.nodes.Node; public interface ShortestPaths { /** * Bereken het kortste pad van de gegeven starttop naar de gegeven bestemming. * Indien er een negatieve cykel voorkomt in de graaf, of de bestemming niet * bereikbaar is vanuit de starttop, genereer je een runtime exceptie met * gepaste foutboodschap. * * @param graph gerichte gewogen graaf * @param source starttop * @param destination bestemming * @return kortste pad van starttop naar bestemming * @throws NegativeCycleException als er een negatieve cykel voorkomt in de graaf * @throws UnreachableDestinationException als de bestemming niet bereikbaar is vanuit de starttop */ List> shortestPath(DirectedGraph graph, Node source, Node destination); class NegativeCycleException extends RuntimeException { public NegativeCycleException() { super("Graaf bevat een negatieve cykel."); } } class UnreachableDestinationException extends RuntimeException { public UnreachableDestinationException() { super("Bestemming onbereikbaar uit starttop."); } } }