Dépôt du be graphe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ShortestPathData.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package org.insa.graphs.algorithm.shortestpath;
  2. import org.insa.graphs.algorithm.AbstractInputData;
  3. import org.insa.graphs.algorithm.ArcInspector;
  4. import org.insa.graphs.model.Graph;
  5. import org.insa.graphs.model.Node;
  6. public class ShortestPathData extends AbstractInputData {
  7. // Origin and destination nodes.
  8. private final Node origin, destination;
  9. /**
  10. * Construct a new instance of ShortestPathInputData with the given parameters.
  11. *
  12. * @param graph Graph in which the path should be looked for.
  13. * @param origin Origin node of the path.
  14. * @param destination Destination node of the path.
  15. * @param arcInspector Filter for arcs (used to allow only a specific set of
  16. * arcs in the graph to be used).
  17. */
  18. public ShortestPathData(Graph graph, Node origin, Node destination, ArcInspector arcInspector) {
  19. super(graph, arcInspector);
  20. this.origin = origin;
  21. this.destination = destination;
  22. }
  23. /**
  24. * @return Origin node for the path.
  25. */
  26. public Node getOrigin() {
  27. return origin;
  28. }
  29. /**
  30. * @return Destination node for the path.
  31. */
  32. public Node getDestination() {
  33. return destination;
  34. }
  35. @Override
  36. public String toString() {
  37. return "Shortest-path from #" + origin.getId() + " to #" + destination.getId() + " ["
  38. + this.arcInspector.toString().toLowerCase() + "]";
  39. }
  40. }