• Articles
  • Api Documentation
Show / Hide Table of Contents
  • AnyPath
    • Graphs
      • Extra
        • Line2D
        • Line3D
        • Triangle
      • HexGrid
        • HexGrid
        • HexGrid.Enumerator
        • HexGridCell
        • HexGridHeuristicProvider
        • HexGridType
      • Line
        • ClosestLineLocationPredicate
        • LineGraph
        • LineGraph.Edge
        • LineGraph.Enumerator
        • LineGraphBuilder
        • LineGraphBuilder.ProtoEdge
        • LineGraphDrawer
        • LineGraphHeuristic
        • LineGraphLocation
        • LineGraphPopulator
        • LineGraphProcessor
        • LineGraphWelder
        • SceneGraph
          • LineGraphNode
          • LineSceneGraph
          • LineSceneGraphEdge
          • SceneGraphNodeEditor
      • NavMesh
        • ClosestNavMeshLocationPredicate
        • CornerAndNormal
        • IUnrolledNavMeshGraphPortal
        • NavMeshGraph
        • NavMeshGraph.EnterCostAndFlags
        • NavMeshGraph.Enumerator
        • NavMeshGraphCorners
        • NavMeshGraphCorners3D
        • NavMeshGraphHeuristic
        • NavMeshGraphLocation
        • NavMeshGraphUnroller
        • NavMeshLineBitmaskMod
        • NavMeshLineMod
        • NavMeshPlaneBitmaskMod
        • NavMeshPlaneMod
        • NavMeshPopulator
        • NavMeshWelder
        • SSFA
        • UnrolledNavMeshGraphPortal
      • Node
        • NodeGraph
        • NodeGraphNode
      • PlatformerGraph
        • ClosestPlatformerGraphLocationPredicate
        • PlatformerGraph
        • PlatformerGraph.Enumerator
        • PlatformerGraphBuilder
        • PlatformerGraphBuilder.ProtoEdge
        • PlatformerGraphDrawer
        • PlatformerGraphHeuristic
        • PlatformerGraphLocation
        • PlatformerGraphPopulator
        • PlatformerGraphProcessor
        • PlatformerGraphWelder
        • SceneGraph
          • PlatformerSceneGraph
          • PlatformerSceneGraphEdge
          • PlatformerSceneGraphNode
          • SceneGraphNodeEditor
      • SquareGrid
        • SquareGrid
        • SquareGrid.Enumerator
        • SquareGridCell
        • SquareGridHeuristicProvider
        • SquareGridHeuristicProviderEightDirectional
        • SquareGridHeuristicProviderManhattanDistance
        • SquareGridType
      • VoxelGrid
        • VoxelGrid
        • VoxelGrid.DirCost
        • VoxelGrid.Enumerator
        • VoxelGridCell
        • VoxelGridDirectionFlags
        • VoxelGridDirectionMod
        • VoxelGridHeuristicProvider
        • VoxelGridHeuristicProviderManhattanDistance
    • Managed
      • ClearFinderFlags
      • FinderExtensions
      • IFinder
      • IOptionReserver<TOption>
      • IOptionValidator<TOption>
      • ImmutableFinderException
      • ManagedDisposeExtensions
      • Results
        • DijkstraResult<TNode>
        • Eval
        • Eval<TOption>
        • MultiEvalResult
        • MultiPathResult<TSeg>
        • Path<TSeg>
        • Path<TOption, TSeg>
    • Native
      • AStarCheapestOption
      • AStarEvalOptionResult
      • AStarEvalResult
      • AStarFindOptionResult
      • AStarFindPathResult
      • AStarOption
      • AStarStops
      • AStar<TNode>
      • ComposedGraph<TGraph, TNode>
      • Edge<TNode>
      • FlagBitmask<TNode>
      • IEdgeMod<TNode>
      • IGraph<TNode>
      • IHeuristicProvider<TNode>
      • INodeFlags
      • IPathProcessor<TNode, TSeg>
      • NativeListWrapper<TSeg>
      • NoEdgeMod<TNode>
      • NoProcessing<TNode>
      • OffsetInfo
      • ReversedGraph<TNode>
      • EdgeMods
        • AdditionalAndExcludeEdges<TNode>
        • AdditionalEdges<TNode>
        • ExcludeEdges<TNode>
        • ExcludeLocations<TNode>
      • Heuristics
        • ALTCompute<TGraph, TNode>
        • ALTSerialization
        • ALT<TNode>
        • LandmarkSelection<TGraph, TNode, TEnumerator>
      • Util
        • IRefComparer<T>
        • NativeMinHeap<T, TComp>
        • NativeRefMinHeap<T, TComp>

Class DijkstraResult<TNode>

Managed result of a DijkstraFinder<TGraph, TNode, TMod>. This contains information about all nodes that are reachable from the starting location within a maximum cost budget. You can also obtain the shortest path from the start to every reachable node from this result.

Inheritance
object
DijkstraResult<TNode>
Namespace: AnyPath.Managed.Results
Assembly: AnyPath.dll
Syntax
public class DijkstraResult<TNode> where TNode : unmanaged, IEquatable<TNode>
Type Parameters
Name Description
TNode

Node type of the graph this ran on

Remarks

While you can obtain every path to a reachable destination, these paths are not stored directly for memory and performance reasons. When you call GetPath(TNode, bool), the path is reconstructed from the information contained within this object. Still however, this class can be roughly the same size as your graph, as every location that has been reached needs to be stored. If you use this often, it may be befinicial to set ReuseResult to true, to prevent unneccessary allocations.

Reconstructing a path via a Dijkstra result is slower than finding a single path using a regular PathFinder, as the reconstruction is not burst compiled. If you don't need to evaluate all possibilities but rather only a few, consider using an OptionFinder instead.

Constructors

DijkstraResult()

Declaration
public DijkstraResult()

Properties

Goals

All possible goal/destination nodes that were reachable from the start within the max cost budget

Declaration
public IEnumerable<TNode> Goals { get; }
Property Value
Type Description
IEnumerable<TNode>

MaxCost

The maximum cost budget that was used for the dijkstra algorithm

Declaration
public float MaxCost { get; }
Property Value
Type Description
float

Start

The starting node that was used for the dijkstra algorithm

Declaration
public TNode Start { get; }
Property Value
Type Description
TNode

Methods

GetPath(Path<TNode>, TNode, bool)

Returns the path from the starting node to a goal node. Supply a result container to hydrate, so no new memory allocations have to be made.

Declaration
public void GetPath(Path<TNode> destResult, TNode goal, bool includeStart)
Parameters
Type Name Description
Path<TNode> destResult

The result to hydrate.

TNode goal
bool includeStart
Remarks

If no path exists from start to goal, a path is returned with HasPath set to false

It is only safe to call this method from the main thread.

GetPath(TNode, bool)

Returns the path from the starting node to a goal node

Declaration
public Path<TNode> GetPath(TNode goal, bool includeStart)
Parameters
Type Name Description
TNode goal
bool includeStart
Returns
Type Description
Path<TNode>

The path from the start to the goal.

Remarks

If no path exists from start to goal, a path is returned with HasPath set to false

It is only safe to call this method from the main thread.

HasPath(TNode)

Returns wether a given destination was reachable from the starting node, within the max cost budget

Declaration
public bool HasPath(TNode goal)
Parameters
Type Name Description
TNode goal

The destination node

Returns
Type Description
bool

Wether the destination is reachable within the max cost budget

TryGetCost(TNode, out float)

Returns the cost of going from the start to the goal, if reachable

Declaration
public bool TryGetCost(TNode goal, out float cost)
Parameters
Type Name Description
TNode goal

The destination to get the cost for

float cost

The cost of travelling from the start to the specified goal node. Zero if the destination is not reachable

Returns
Type Description
bool

Wether the destination is reachable

Extension Methods

FinderExtensions.AddOption<T, TNode, TOption>(T, TOption, TNode, TNode)
FinderExtensions.AddOptions<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
FinderExtensions.AddRange<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
FinderExtensions.AddRequest<T, TNode>(T, TNode, TNode)
FinderExtensions.AddRequests<T, TNode>(T, IEnumerable<TNode>)
FinderExtensions.AddStop<T, TNode>(T, TNode)
FinderExtensions.AddStops<T, TNode>(T, IEnumerable<TNode>)
FinderExtensions.SetComparer<T, TOption>(T, IComparer<TOption>)
FinderExtensions.SetEdgeMod<T, TMod>(T, TMod)
FinderExtensions.SetGraph<T, TGraph>(T, TGraph)
FinderExtensions.SetHeuristicProvider<T, TH>(T, TH)
FinderExtensions.SetPathProcessor<T, TProc>(T, TProc)
FinderExtensions.SetReserver<T, TOption>(T, IOptionReserver<TOption>)
FinderExtensions.SetStartAndGoal<T, TNode>(T, TNode, TNode)
FinderExtensions.SetValidator<T, TOption>(T, IOptionValidator<TOption>)
In This Article
Back to top Generated by DocFX