Table of Contents

Class DirectedGraph<TNodeRef, TEdgeData>

Namespace
KSP.Sim
Assembly
Assembly-CSharp.dll
public abstract class DirectedGraph<TNodeRef, TEdgeData>

Type Parameters

TNodeRef
TEdgeData
Inheritance
DirectedGraph<TNodeRef, TEdgeData>
Derived
Inherited Members
Extension Methods

Constructors

DirectedGraph()

public DirectedGraph()

DirectedGraph(DirectedGraph<TNodeRef, TEdgeData>)

public DirectedGraph(DirectedGraph<TNodeRef, TEdgeData> other)

Parameters

other DirectedGraph<TNodeRef, TEdgeData>

Fields

EMPTY_DIRECTED_EDGES

protected static readonly IReadOnlyCollection<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> EMPTY_DIRECTED_EDGES

Field Value

IReadOnlyCollection<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

EMPTY_NODE_EDGES

protected static readonly IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> EMPTY_NODE_EDGES

Field Value

IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

_nodeEdgeStateMap

protected readonly Dictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.NodeEdgeState> _nodeEdgeStateMap

Field Value

Dictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.NodeEdgeState>

_nodeEdges

protected readonly HashSet<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> _nodeEdges

Field Value

HashSet<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

_nodes

protected readonly HashSet<TNodeRef> _nodes

Field Value

HashSet<TNodeRef>

Properties

Edges

public ReadOnlySet<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> Edges { get; }

Property Value

ReadOnlySet<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

HasChanged

public bool HasChanged { get; set; }

Property Value

bool

this[TNodeRef]

public IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> this[TNodeRef from] { get; }

Parameters

from TNodeRef

Property Value

IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

this[TNodeRef, TNodeRef]

public DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge this[TNodeRef from, TNodeRef to] { get; }

Parameters

from TNodeRef
to TNodeRef

Property Value

DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge

Nodes

public ReadOnlySet<TNodeRef> Nodes { get; }

Property Value

ReadOnlySet<TNodeRef>

Methods

AddNode(TNodeRef)

public void AddNode(TNodeRef nodeReference)

Parameters

nodeReference TNodeRef

ClearGraph()

public void ClearGraph()

GetEdge(TNodeRef, TNodeRef)

public DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge GetEdge(TNodeRef from, TNodeRef to)

Parameters

from TNodeRef
to TNodeRef

Returns

DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge

GetEdges(TNodeRef)

public IReadOnlyCollection<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> GetEdges(TNodeRef nodeFrom)

Parameters

nodeFrom TNodeRef

Returns

IReadOnlyCollection<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

GetInboundEdges(TNodeRef)

public IReadOnlyCollection<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> GetInboundEdges(TNodeRef nodeTo)

Parameters

nodeTo TNodeRef

Returns

IReadOnlyCollection<DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

GetInboundNodeEdges(TNodeRef)

public IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> GetInboundNodeEdges(TNodeRef nodeTo)

Parameters

nodeTo TNodeRef

Returns

IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

GetNodeEdgeEnumerator()

public IEnumerator<KeyValuePair<TNodeRef, IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>>> GetNodeEdgeEnumerator()

Returns

IEnumerator<KeyValuePair<TNodeRef, IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>>>

GetNodeEdges(TNodeRef)

public IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge> GetNodeEdges(TNodeRef nodeFrom)

Parameters

nodeFrom TNodeRef

Returns

IReadOnlyDictionary<TNodeRef, DirectedGraph<TNodeRef, TEdgeData>.DirectedEdge>

GetOrAllocateNodeState(TNodeRef)

protected DirectedGraph<TNodeRef, TEdgeData>.NodeEdgeState GetOrAllocateNodeState(TNodeRef nodeReference)

Parameters

nodeReference TNodeRef

Returns

DirectedGraph<TNodeRef, TEdgeData>.NodeEdgeState

HasEdge(TNodeRef, TNodeRef)

public bool HasEdge(TNodeRef from, TNodeRef to)

Parameters

from TNodeRef
to TNodeRef

Returns

bool

HasNode(TNodeRef)

public bool HasNode(TNodeRef node)

Parameters

node TNodeRef

Returns

bool

NewNodeDictionary<TValue>()

protected static Dictionary<TNodeRef, TValue> NewNodeDictionary<TValue>()

Returns

Dictionary<TNodeRef, TValue>

Type Parameters

TValue

NewNodeHashSet()

protected static HashSet<TNodeRef> NewNodeHashSet()

Returns

HashSet<TNodeRef>

RemoveEdge(TNodeRef, TNodeRef)

public void RemoveEdge(TNodeRef fromNodeReference, TNodeRef toNodeReference)

Parameters

fromNodeReference TNodeRef
toNodeReference TNodeRef

RemoveNode(TNodeRef)

public void RemoveNode(TNodeRef nodeReference)

Parameters

nodeReference TNodeRef

SetEdge(TNodeRef, TNodeRef, TEdgeData, bool, bool)

public void SetEdge(TNodeRef fromNodeReference, TNodeRef toNodeReference, TEdgeData edgeData = default, bool skipValidation = false, bool addInboundEdges = true)

Parameters

fromNodeReference TNodeRef
toNodeReference TNodeRef
edgeData TEdgeData
skipValidation bool
addInboundEdges bool

TryGetEdgeData(TNodeRef, TNodeRef, out TEdgeData)

public bool TryGetEdgeData(TNodeRef from, TNodeRef to, out TEdgeData edgeData)

Parameters

from TNodeRef
to TNodeRef
edgeData TEdgeData

Returns

bool

ValidateAllEdges()

protected bool ValidateAllEdges()

Returns

bool

ValidateEdge(TNodeRef, TNodeRef, TEdgeData)

protected virtual bool ValidateEdge(TNodeRef fromNodeReference, TNodeRef toNodeReference, TEdgeData edgeData)

Parameters

fromNodeReference TNodeRef
toNodeReference TNodeRef
edgeData TEdgeData

Returns

bool