API Edge - shmellyorc/Box GitHub Wiki
Edge
Namespace: Box.Pathfind
Description:
Represents a connection (edge) between two vertices in the A* graph. Each Edge
contains a target Vertex
, a traversal cost weight, and an enabled flag to include or exclude the edge during pathfinding.
Constructors
public Edge(Vertex target, float cost)
Initializes a new edge to the specified target vertex with the given traversal cost.
Properties
Property | Type | Description |
---|---|---|
Target |
Vertex |
The vertex that this edge leads to. |
Cost |
float |
The cost (weight) of traversing this edge. |
IsEnabled |
bool |
Indicates whether the edge is active and should be considered during pathfinding (default true ). |
Methods
None
Examples
// Create a bidirectional connection with a custom cost
var edge = new Edge(vertexB, 2.5f);
Console.WriteLine(edge.Cost); // Output: 2.5
Console.WriteLine(edge.IsEnabled); // Output: True
// Disable the edge to exclude it from path calculations
edge.IsEnabled = false;