findShortestPath method
- String sourceKref,
- String targetKref, {
- List<
String> ? edgeTypeFilter, - int? maxDepth,
- bool allShortest = false,
inherited
Finds the shortest path between two revisions.
sourceKref is the starting revision.
targetKref is the destination revision.
edgeTypeFilter filters by edge types (empty for all).
maxDepth limits search depth (default: 10).
allShortest returns all shortest paths instead of just one.
Implementation
Future<ShortestPathResponse> findShortestPath(
String sourceKref,
String targetKref, {
List<String>? edgeTypeFilter,
int? maxDepth,
bool allShortest = false,
}) async {
final request = ShortestPathRequest()
..sourceKref = Kref(uri: sourceKref)
..targetKref = Kref(uri: targetKref)
..allShortest = allShortest;
if (edgeTypeFilter != null && edgeTypeFilter.isNotEmpty) {
request.edgeTypeFilter.addAll(edgeTypeFilter);
}
if (maxDepth != null) {
request.maxDepth = maxDepth;
}
return stub.findShortestPath(request, options: callOptions);
}