Struct ScyllaGraphNode
Lightweight, immutable node descriptor for use with all Scylla graph structures.
Stores a unique integer identifier and a set of bitpacked ScyllaGraphNodeFlags
that describe per-node properties such as walkability and user-defined tags.
The struct is 8 bytes, fully unmanaged, and allocation-free - suitable for
Span<ScyllaGraphNode> buffers and Unity DOTS NativeArray contexts.
Implements
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public readonly struct ScyllaGraphNode : IEquatable<ScyllaGraphNode>
Remarks
Equality is based solely on ID; two nodes with the same ID but different Flags compare as equal and share the same hash code. This design allows nodes to be keyed by ID in dictionaries and hash sets while flags can be updated (via WithFlags(ScyllaGraphNodeFlags)) without affecting lookup behaviour.
Use IsWalkable() or HasFlag(ScyllaGraphNodeFlags) to query node state during pathfinding. The ScyllaGraphAlgorithms traversal methods respect the Walkable flag by default.
Constructors
ScyllaGraphNode(int, ScyllaGraphNodeFlags)
Initializes a new ScyllaGraphNode with the specified ID and flags.
Declaration
public ScyllaGraphNode(int id, ScyllaGraphNodeFlags flags = ScyllaGraphNodeFlags.Walkable)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The unique integer identifier for this node within its graph. No uniqueness check is performed here; the owning graph validates uniqueness at insertion time. |
| ScyllaGraphNodeFlags | flags | Initial ScyllaGraphNodeFlags for this node. Defaults to Walkable, meaning the node is traversable by default. Pass None to create a non-walkable node, or combine with tag flags as needed. |
Properties
Flags
Bitpacked flags that describe this node's runtime properties. Bit 0 is the reserved Walkable flag; bits 1-31 are user-defined tags (Tag0 through Tag30) that can encode terrain type, zone membership, or any other per-node classification. Replace the entire flag set via WithFlags(ScyllaGraphNodeFlags).
Declaration
public ScyllaGraphNodeFlags Flags { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaGraphNodeFlags |
ID
Unique integer identifier for this node within its owning graph. Node IDs must be unique per graph instance; the graph implementations (e.g. ScyllaAdjacencyListGraph) enforce this invariant at insertion time. ID equality is the sole criterion for Equals(ScyllaGraphNode) and GetHashCode().
Declaration
public int ID { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Equals(ScyllaGraphNode)
Determines whether this node equals other by comparing
ID only. Flags differences are ignored, so two
nodes with the same ID but different flags are considered equal.
Declaration
public bool Equals(ScyllaGraphNode other)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphNode | other | The node 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
HasFlag(ScyllaGraphNodeFlags)
Returns true if this node has all bits of flag set in
Flags. For combined flag values (e.g., Tag0 | Tag1), all
specified bits must be present for this method to return true.
Declaration
public bool HasFlag(ScyllaGraphNodeFlags flag)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphNodeFlags | flag | The ScyllaGraphNodeFlags bitmask to test. Can be a single flag or a bitwise combination of multiple flags. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsWalkable()
Returns true if this node has the Walkable
flag set, indicating that graph traversal algorithms are permitted to enter or pass
through this node. Convenience shorthand for
HasFlag(ScyllaGraphNodeFlags.Walkable).
Declaration
public bool IsWalkable()
Returns
| Type | Description |
|---|---|
| bool |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
WithFlags(ScyllaGraphNodeFlags)
Returns a new ScyllaGraphNode with the same ID but the
Flags replaced by flags. Because the struct is
immutable, use this method - or TrySetNodeFlags(int, ScyllaGraphNodeFlags) on
the owning graph - to update node state without constructing an entirely new descriptor.
Declaration
public ScyllaGraphNode WithFlags(ScyllaGraphNodeFlags flags)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphNodeFlags | flags | The complete replacement flags value for the returned node. |
Returns
| Type | Description |
|---|---|
| ScyllaGraphNode | A new node with |
Operators
operator ==(ScyllaGraphNode, ScyllaGraphNode)
Declaration
public static bool operator ==(ScyllaGraphNode left, ScyllaGraphNode right)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphNode | left | |
| ScyllaGraphNode | right |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(ScyllaGraphNode, ScyllaGraphNode)
Declaration
public static bool operator !=(ScyllaGraphNode left, ScyllaGraphNode right)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaGraphNode | left | |
| ScyllaGraphNode | right |
Returns
| Type | Description |
|---|---|
| bool |