V - The Object that represent a vertexW - The Object that represent the edge (more specifically the weight of the edge)public interface VisitStrategy<V,W extends java.lang.Number>
| Modifier and Type | Method and Description |
|---|---|
VisitInfo<V> |
visit(Graph<V,W> graph,
V source,
java.util.function.Consumer<V> visit)
With this the graph will be visited accordingly to the strategy of the visit.
Some strategy can accept a source vertex null, because they visit all the graph anyway. If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
VisitInfo<V> visit(Graph<V,W> graph, V source, java.util.function.Consumer<V> visit) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
graph - the graph to visitsource - the source of the visitvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if one of the arguments is null (only the consumers can be null)java.lang.IllegalArgumentException - if the source vertex is not in the graphjava.lang.UnsupportedOperationException - in the case that the visit algorithm cannot be applied to the graph