How would Dijkstra's Algorithm even be applicable to Lightning?

I would just like to start this off by saying I don't know a lot about this topic, which is why I have come to ask this question. When it comes to the topic of Lightning, I've often seen people voice their concerns over the issue of routing payments. This is obviously a known issue because for a payment itself to route, there needs to be a path that:

  1. exists
  2. has sufficient liquidity
  3. doesn't potentially change before the payment can be successfully routed

These are obviously legitimate issues, and I've seen them dismissed by many people who are in support of the Core roadmap by yelling out their cool buzzword's like "Djikstra's Algorithm", when discussing how a path can be found. When searching up the issue concerning routing of Bitcoins in LN, it seems even people who are knowledgeable on Bitcoin and Lightning Network agrees that pathfinding can be solved this way.

I was interested in Dijkstra's algorithm, so I did a little wikipedia search on the topic to gain a better understanding of how pathfinding would work. From what I understand, the entire process of Dijkstra's algorithm for a network of nodes is:

  1. Start at an individual vertex/node (A)
  2. Assume all other nodes have an infinite weight (or don't)
  3. Mark the weight for the adjacent nodes/vertices as the weight of the direct path from node A to all of the adjacent nodes
  4. Move to one of the adjacent nodes
  5. If the new node connects to one of the nodes that was adjacent to the previous node, evaluate the weight of the path to that node, and update the weight of said node accordingly, to get the lowest possible weight for the given node

Basically, it's repeating this entire process for the entire network of nodes to finally find the shortest path from the start to the finish. I've heard that what makes it so great at optimization is also the time complexity is logarithmic, meaning that computing the potential path isn't an issue. There are only a few *big* problems I can find when trying to apply this in the context of Lightning:

  1. The 'map' of the network, and the weight of all nodes is known at the time that the algorithm starts to find a path. This 'map' doesn't change, so the route itself can predictably be guaranteed.
  2. It is known that a path exists from the first node to the end node, and all paths will undoubtedly work, but they'll just be less efficient if they aren't the optimal one. Not all paths in Lightning are guaranteed to work because a path could exist, but also not have sufficient liquidity.
  3. When a path is made with Dijkstra's algorithm, it won't change. The path itself remains constant. With Lightning, it technically is possible for the path you were working on finding becoming invalid.

I'm not a computer scientist, or someone with extensive knowledge in Bitcoin. I'm just a regular person, so I could be wrong in my reasoning, but how would something like Dijkstra's algorithm work when the assumptions being made directly go against the nature of the Lightning Network? I'm genuinely interested because as I gain more knowledge over time, I'm interested in simulating the Lightning Network itself (once I get the skills necessary to do so).

submitted by /u/1MightBeAPenguin to r/btc
[link] [comments]
Quelle: bitcoin-en