Struct ScyllaGraphEdge<TEdgeData>
A typed, immutable edge descriptor that pairs a ScyllaGraphEdge with
arbitrary user data of type TEdgeData. Use this variant when
graph edges need to carry domain-specific metadata - for example terrain type,
road classification, or animation triggers - without requiring a separate lookup table.
Implements
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public readonly struct ScyllaGraphEdge<TEdgeData> : IEquatable<ScyllaGraphEdge<TEdgeData>>
Type Parameters
| Name | Description |
|---|---|
| TEdgeData | The type of the per-edge user data payload. No constraints are imposed; however, using
|
Remarks
Equality and hash-code comparisons are based entirely on the underlying Edge (i.e., FromID, ToID, and approximately-compared weight). The Data payload is intentionally excluded from equality so that two edges connecting the same nodes with the same cost compare as equal regardless of their attached metadata.
Use WithData(TEdgeData) and WithWeight(float) to create modified copies without constructing a new descriptor from scratch - the struct is immutable.
Constructors
ScyllaGraphEdge(ScyllaGraphEdge, TEdgeData)
Initializes a new ScyllaGraphEdge<TEdgeData> from an existing ScyllaGraphEdge and a user data payload.
Declaration
public ScyllaGraphEdge(ScyllaGraphEdge edge, TEdgeData data)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphEdge | edge | The base edge descriptor providing endpoint IDs and weight. |
| TEdgeData | data | The user data payload to associate with this edge. |
ScyllaGraphEdge(int, int, float, TEdgeData)
Initializes a new ScyllaGraphEdge<TEdgeData> with explicit endpoint IDs,
weight, and a user data payload. Equivalent to constructing a bare ScyllaGraphEdge
and pairing it with data.
Declaration
public ScyllaGraphEdge(int fromID, int toID, float weight, TEdgeData data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | fromID | ID of the source node. |
| int | toID | ID of the target node. |
| float | weight | Traversal cost of this edge. |
| TEdgeData | data | The user data payload to associate with this edge. |
Properties
Data
The user-defined payload attached to this edge. Excluded from equality comparisons; two typed edges with identical Edge values but different Data are considered equal. Replace via WithData(TEdgeData).
Declaration
public TEdgeData Data { get; }
Property Value
| Type | Description |
|---|---|
| TEdgeData |
Edge
The underlying ScyllaGraphEdge containing the source node ID, target node ID, and traversal weight. All graph topology operations (neighbor queries, path reconstruction) operate on this base descriptor.
Declaration
public ScyllaGraphEdge Edge { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaGraphEdge |
Methods
Equals(ScyllaGraphEdge<TEdgeData>)
Determines whether this typed edge equals other by comparing
only the underlying Edge descriptor. The Data payload
is intentionally excluded so that metadata differences do not affect topology equality.
Declaration
public bool Equals(ScyllaGraphEdge<TEdgeData> other)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphEdge<TEdgeData> | other | The typed edge to compare against. |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
Reversed()
Returns a new ScyllaGraphEdge<TEdgeData> with FromID and ToID swapped, preserving both the original weight and the Data payload.
Declaration
public ScyllaGraphEdge<TEdgeData> Reversed()
Returns
| Type | Description |
|---|---|
| ScyllaGraphEdge<TEdgeData> | A reversed copy of this edge with identical weight and user data. |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
WithData(TEdgeData)
Returns a new ScyllaGraphEdge<TEdgeData> with the same Edge (endpoints and weight) but a replacement Data payload. Use this to update metadata on an edge without rebuilding its topology descriptor.
Declaration
public ScyllaGraphEdge<TEdgeData> WithData(TEdgeData data)
Parameters
| Type | Name | Description |
|---|---|---|
| TEdgeData | data | The new user data payload for the returned edge. |
Returns
| Type | Description |
|---|---|
| ScyllaGraphEdge<TEdgeData> | A copy of this edge with only Data replaced. |
WithWeight(float)
Returns a new ScyllaGraphEdge<TEdgeData> with the same endpoint IDs and Data payload but a replacement edge weight. Delegates to WithWeight(float) on the underlying Edge.
Declaration
public ScyllaGraphEdge<TEdgeData> WithWeight(float weight)
Parameters
| Type | Name | Description |
|---|---|---|
| float | weight | The replacement traversal cost for the new edge. |
Returns
| Type | Description |
|---|---|
| ScyllaGraphEdge<TEdgeData> | A copy of this edge with only the weight replaced. |
Operators
operator ==(ScyllaGraphEdge<TEdgeData>, ScyllaGraphEdge<TEdgeData>)
Returns true if left and right have equal
Edge descriptors (endpoint IDs and approximately equal weight).
Data is not considered.
Declaration
public static bool operator ==(ScyllaGraphEdge<TEdgeData> left, ScyllaGraphEdge<TEdgeData> right)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphEdge<TEdgeData> | left | |
| ScyllaGraphEdge<TEdgeData> | right |
Returns
| Type | Description |
|---|---|
| bool |
See Also
operator !=(ScyllaGraphEdge<TEdgeData>, ScyllaGraphEdge<TEdgeData>)
Declaration
public static bool operator !=(ScyllaGraphEdge<TEdgeData> left, ScyllaGraphEdge<TEdgeData> right)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphEdge<TEdgeData> | left | |
| ScyllaGraphEdge<TEdgeData> | right |
Returns
| Type | Description |
|---|---|
| bool |