DotNetLightning


Graph Module

Types and nested modules

Type/Module Description

GraphEdge

ChannelDesc

DirectedLNGraph

GraphLabel

PublicChannel

RichWeight

The cumulative weight of a set of edges (path in the graph).

WeightRatios

We use heuristics to calculate the weight of an edge based on channel age, cltv delta and capacity. We favor older channels, with bigger capacity and small cltv delta

WeightedNode

WeightedPath

Functions and values

Function or value Description

dijkstraShortestPath g sourceNode targetNode ignoredEdges ignoredVertices extraEdges initialWeight boundaries currentBlockHeight wr

Full Usage: dijkstraShortestPath g sourceNode targetNode ignoredEdges ignoredVertices extraEdges initialWeight boundaries currentBlockHeight wr

Parameters:
Returns: seq<GraphLabel>

Finds the shortest path in the graph, uses a modified version of Dijkstra's algorithm that computes the shortest path from the target to the source (this is because we )

The graph on which will be performed the search The starting node of the path we're looking for The destination node of the path a list of edges we do not want to consider a list of extra edges we want to consider but are not currently in the graph an object containing the ratios used to 'weight' edges when searching for the shortest path the height of the chain tip (latest block) a predicate function that can used to impose limits

g : DirectedLNGraph
sourceNode : NodeId
targetNode : NodeId
ignoredEdges : Set<ChannelDesc>
ignoredVertices : Set<NodeId>
extraEdges : Set<GraphLabel>
initialWeight : RichWeight
boundaries : RichWeight -> bool
currentBlockHeight : BlockHeight
wr : WeightRatios option
Returns: seq<GraphLabel>

pathWeight path amount isPartial currentBlockHeight wr

Full Usage: pathWeight path amount isPartial currentBlockHeight wr

Parameters:
Returns: RichWeight

Calculates the total cost of a path (amount + fees), direct channels with the source will have a cost of 0 (pay no fees)

path : seq<GraphLabel>
amount : LNMoney
isPartial : bool
currentBlockHeight : BlockHeight
wr : WeightRatios option
Returns: RichWeight

yenKShortestPaths g sourceNode targetNode amount ignoredEdges ignoredVertices extraEdges pathsToFind wr currentBlockHeight boundaries

Full Usage: yenKShortestPaths g sourceNode targetNode amount ignoredEdges ignoredVertices extraEdges pathsToFind wr currentBlockHeight boundaries

Parameters:
Returns: ResizeArray<WeightedPath>
g : DirectedLNGraph
sourceNode : NodeId
targetNode : NodeId
amount : LNMoney
ignoredEdges : Set<ChannelDesc>
ignoredVertices : Set<NodeId>
extraEdges : Set<GraphLabel>
pathsToFind : int
wr : WeightRatios option
currentBlockHeight : BlockHeight
boundaries : RichWeight -> bool
Returns: ResizeArray<WeightedPath>