• 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>

Struct ReversedGraph<TNode>

A reversed edge representation of a graph. Used by the ALT heuristic provider for directed graphs.

Implements
IGraph<TNode>
IDisposable
Namespace: AnyPath.Native
Assembly: AnyPath.dll
Syntax
public struct ReversedGraph<TNode> : IGraph<TNode>, IDisposable where TNode : unmanaged, IEquatable<TNode>
Type Parameters
Name Description
TNode

Constructors

ReversedGraph(Allocator)

Construct a container for the reversed graph. Which can then be populated using ScheduleCompute<TGraph, TEnumerator>(TGraph, TEnumerator, JobHandle) or Compute<TGraph, TEnumerator>(TGraph, TEnumerator, Allocator).

Declaration
public ReversedGraph(Allocator allocator)
Parameters
Type Name Description
Allocator allocator

Methods

Compute<TGraph, TEnumerator>(TGraph, TEnumerator)

Computes the reversed graph of a source graph immediately

Declaration
public void Compute<TGraph, TEnumerator>(TGraph source, TEnumerator nodeEnumerator) where TGraph : struct, IGraph<TNode> where TEnumerator : struct, IEnumerator<TNode>
Parameters
Type Name Description
TGraph source

The source graph

TEnumerator nodeEnumerator

Enumerator that yields all nodes in the graph

Type Parameters
Name Description
TGraph

Type of graph to construct a reverse graph for

TEnumerator

The type of enumerator, this can be a struct enumerator used on Unity's native collections

Compute<TGraph, TEnumerator>(TGraph, TEnumerator, Allocator)

Computes the reversed graph of a source graph. That is, all the edges will be reversed. This is useful for directed graphs where you want to run Dijkstra's algorithm to know the shortest path from every node in the graph to a certain location. The ALT heuristic for directed graph needs this information for preprocessing.

Declaration
public static ReversedGraph<TNode> Compute<TGraph, TEnumerator>(TGraph source, TEnumerator nodeEnumerator, Allocator allocator) where TGraph : struct, IGraph<TNode> where TEnumerator : struct, IEnumerator<TNode>
Parameters
Type Name Description
TGraph source

The source graph

TEnumerator nodeEnumerator

Enumerator that yields all nodes in the graph

Allocator allocator

Allocator for the reversed graph

Returns
Type Description
ReversedGraph<TNode>

A reversed edge representation of the source graph

Type Parameters
Name Description
TGraph

Type of graph to construct a reverse graph for

TEnumerator

The type of enumerator, this can be a struct enumerator used on Unity's native collections

Remarks

This method is not burst compiled. If your source graph is large, it might be benificial to pre-allocate the ReversedGraph structure and populate it using ScheduleCompute<TGraph, TEnumerator>(TGraph, TEnumerator, JobHandle) or Compute<TGraph, TEnumerator>(TGraph, TEnumerator, Allocator)

ScheduleCompute<TGraph, TEnumerator>(TGraph, TEnumerator, JobHandle)

Schedules a job that computes the reversed graph of a source graph. That is, all the edges will be reversed. This is useful for directed graphs where you want to run Dijkstra's algorithm to know the shortest path from every node in the graph to a certain location. The ALT heuristic for directed graph needs this information for preprocessing.

Declaration
public JobHandle ScheduleCompute<TGraph, TEnumerator>(TGraph source, TEnumerator nodeEnumerator, JobHandle dependsOn = default) where TGraph : struct, IGraph<TNode> where TEnumerator : struct, IEnumerator<TNode>
Parameters
Type Name Description
TGraph source

The source graph

TEnumerator nodeEnumerator

Enumerator that yields all nodes in the graph

JobHandle dependsOn
Returns
Type Description
JobHandle
Type Parameters
Name Description
TGraph

Type of graph to construct a reverse graph for

TEnumerator

The type of enumerator, this can be a struct enumerator used on Unity's native collections

Implements

IGraph<TNode>
IDisposable

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>)
ManagedDisposeExtensions.DisposeGraph<TGraph>(TGraph)
In This Article
Back to top Generated by DocFX