Interface IScyllaMutableGraph<TNodeData, TEdgeData>
Generic mutable graph interface that attaches typed user data to both nodes and edges. Extends IScyllaReadOnlyGraph<TNodeData, TEdgeData> and IScyllaMutableGraph<TNodeData> with edge-data-aware mutation operations.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public interface IScyllaMutableGraph<TNodeData, TEdgeData> : IScyllaReadOnlyGraph<TNodeData, TEdgeData>, IScyllaMutableGraph<TNodeData>, IScyllaReadOnlyGraph<TNodeData>, IScyllaMutableGraph, IScyllaReadOnlyGraph, IScyllaGraph, IScyllaCollection
Type Parameters
| Name | Description |
|---|---|
| TNodeData | The type of user data stored alongside each node. May be any managed or value type. |
| TEdgeData | The type of user data stored alongside each edge. May be any managed or value type.
Edges added through the inherited untyped overload
TryAddEdge(int, int, float) will carry
|
Remarks
Position in the hierarchy. This is the most fully-featured mutable interface in the graph hierarchy, providing typed data mutation for both nodes and edges. It combines the typed read-only contract from IScyllaReadOnlyGraph<TNodeData, TEdgeData> with the full mutation contract from IScyllaMutableGraph<TNodeData>.
Untyped edge addition. The inherited untyped
TryAddEdge(int, int, float) remains available.
Edges added via it carry default(TEdgeData). To associate data at creation
time, use TryAddEdge(int, int, float, TEdgeData) instead.
Undirected graphs and edge data. For undirected graphs, adding a typed edge (A, B, w, data) stores the data canonically once. The reverse adjacency direction is accessible but shares the same data value.
Methods
TryAddEdge(int, int, float, TEdgeData)
Attempts to add an edge with user data between two existing nodes.
Declaration
bool TryAddEdge(int fromID, int toID, float weight, TEdgeData data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | fromID | The ID of the source node. |
| int | toID | The ID of the target node. |
| float | weight | The weight of the edge. For graphs whose Properties
do not include Weighted, this value is ignored
and the stored weight is always |
| TEdgeData | data | The |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
This is the preferred way to add edges to a typed-edge graph because it associates the user data atomically at creation time. The inherited untyped overload TryAddEdge(int, int, float) is still available for cases where edge data is set in a separate pass via TrySetEdgeData(int, int, TEdgeData).
For undirected graphs, the reverse adjacency is created automatically and shares
the same data value.
See Also
TrySetEdgeData(int, int, TEdgeData)
Attempts to update the user data stored on an existing edge.
Declaration
bool TrySetEdgeData(int fromID, int toID, TEdgeData data)
Parameters
| Type | Name | Description |
|---|---|---|
| int | fromID | The ID of the source node. For undirected graphs, argument order is irrelevant. |
| int | toID | The ID of the target node. For undirected graphs, argument order is irrelevant. |
| TEdgeData | data | The new |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
To retrieve the current edge data before updating, use TryGetEdgeData(int, int, out TEdgeData).
For undirected graphs, updating the data of edge (A, B) also affects the data visible when querying edge (B, A), since both directions share the same stored value.