N - Тип вершиныE - Тип ребраpublic class PathFinder<N,E> extends Object implements Iterator<Path<N,E>>
Производит обход графа формируя возможные пути. Обход производится по крайчащим путям. Конечная вершина поиска определяется пользователем данного класса.
За один вызов next() выдает один возможный путь из указанной точки.
| Modifier and Type | Field and Description |
|---|---|
protected Comparator<Path<N,E>> |
comparator |
protected Path.Direction |
direction
Направление движения
|
protected SingleDirectedGraph<N,E> |
graph
Граф в котором производится поиск
|
protected List<Path<N,E>> |
paths
Список путей используемых в поиске.
|
| Constructor and Description |
|---|
PathFinder(SingleDirectedGraph<N,E> graph,
N start,
Path.Direction direction,
Comparator<Path<N,E>> comparator)
Конструктор
|
PathFinder(SingleDirectedGraph<N,E> graph,
N start,
Path.Direction direction,
Convertor<Edge<N,E>,Double> getWeight)
Конструктор
|
| Modifier and Type | Method and Description |
|---|---|
protected Path<N,E> |
append(Path<N,E> path,
Edge<N,E> e)
Добавляет ребро в конец пути
|
protected Comparator<Path<N,E>> |
createComparatorFrom(Convertor<Edge<N,E>,Double> getWeight)
Создание Comparator для пути
|
protected Path<N,E> |
createPath()
Создаает путь
|
protected List<Path<N,E>> |
createPathsList()
Создает список путей
|
protected double |
getIntWeightOf(Path<N,E> path,
Convertor<Edge<N,E>,Double> getWeight)
Полчение веса пути
|
protected Iterable<Edge<N,E>> |
getNextEdges(N n)
Извлекает исходящие ребра/дуги из вершины n в соот. движению.
|
boolean |
hasNext() |
Path<N,E> |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingprotected SingleDirectedGraph<N,E> graph
protected Path.Direction direction
protected List<Path<N,E>> paths
protected Comparator<Path<N,E>> comparator
public PathFinder(SingleDirectedGraph<N,E> graph, N start, Path.Direction direction, Convertor<Edge<N,E>,Double> getWeight)
graph - Одно направленный графstart - Начальная вершина путиdirection - Направление движенияgetWeight - Получение веса ребра, вес должен быть положительным или равен нулюpublic PathFinder(SingleDirectedGraph<N,E> graph, N start, Path.Direction direction, Comparator<Path<N,E>> comparator)
graph - Одно направленный графstart - Начальная вершина путиdirection - Направление движенияcomparator - Сравнение длины путейprotected double getIntWeightOf(Path<N,E> path, Convertor<Edge<N,E>,Double> getWeight)
path - ПутьgetWeight - Получение веса ребраprotected Comparator<Path<N,E>> createComparatorFrom(Convertor<Edge<N,E>,Double> getWeight)
getWeight - Получение веса ребраprotected List<Path<N,E>> createPathsList()
protected Path<N,E> append(Path<N,E> path, Edge<N,E> e)
path - Путьe - Реброprotected Iterable<Edge<N,E>> getNextEdges(N n)
n - ВершинаCopyright © 2018. All rights reserved.