简体   繁体   English

异步无向树中的领导者选举

[英]Leader Election in an asynchronous undirected Tree

I have an asynchronous network undirected tree (V,E) with n=|V|我有一个异步网络无向树(V,E),n=|V| processes.过程。 The only things that I know for my network is that all processes have unique ids (UIDs), they know the number of their neighbors but they do not know the diameter and the size of the network.对于我的网络,我唯一知道的是所有进程都有唯一的 ID (UID),它们知道邻居的数量,但不知道网络的直径和大小。 I tried to construct a leader election algorithm in such a network as following:我尝试在这样的网络中构建领导者选举算法如下:

  A convergecast of <leader> messages is initiated starting from the 
  leaves of the tree. 

  Each leaf node is initially enabled to send a <leader> message to 
  its unique neighbor. Any node that receives <leader> messages from 
  all but one of its neighbors is enabled to send an <leader> message 
  to its remaining neighbor.

  In the end,
    1. Some particular process receives <leader> messages along all
    of its channels before it has sent out an <leader> message
     the process at which the <leader> messages converge elects
    itself as the leader.

    2. <leader> messages are sent on some particular edge in both
    directions.
    the process with the largest pid among the processes that are
    adjacent to this edge elects itself as the leader.

Is my idea correct and does the above algorithm terminates with all the processes knowing the leader?我的想法是否正确,上述算法是否会在所有进程都知道领导者的情况下终止?

Your algorithm is correct, but has the following limitations:您的算法是正确的,但有以下限制:

  1. Nodes only now their next leader, but not the global leader.节点现在只是他们的下一个领导者,而不是全球领导者。 I don't know whether your goal is that every node knows the global leader or their personal leader .不知道你的目标是每个节点都认识全局领导还是自己的个人领导
  2. The global leader is not necessarily the process with the largest pid nor the root node of your tree.全局领导者不一定是具有最大 pid 的进程,也不一定是树的根节点。 Example: Suppose a chain of 5 nodes with the second node as root.示例:假设一个由 5 个节点组成的链,其中第二个节点为根。 This graph is a tree with the first and the fifth node as leaves.这个图是一棵树,第一个和第五个节点是叶子。 Give the root node the largest pid.给根节点最大的pid。 Your algorithm selects the third node of the chain as the global leader.您的算法选择链的第三个节点作为全局领导者。
  3. Your algorithm is in practice not deterministic: Suppose a balanced tree.您的算法实际上不是确定性的:假设一棵平衡树。 Assume that one leave submits its leader message with a delay (can happen in practice).假设一个休假延迟提交其领导者消息(在实践中可能发生)。 The selected global leader depends on the delay.选定的全局领导者取决于延迟。
  4. Your algorithm only works for trees.您的算法仅适用于树。

I don't know whether these limitations are a problem for you.我不知道这些限制对你来说是否有问题。 Since I don't have enough reputation to comment on your question, I'm also unable to ask.由于我没有足够的声誉来评论您的问题,因此我也无法提问。

The correctness of your algorithm is provable with mathematical induction.你的算法的正确性可以用数学归纳法证明。

  1. Base case: Tree with a single node.基本情况:具有单个节点的树。 Obviously, your algorithm is correct.显然,你的算法是正确的。
  2. Induction step: Add a node to the tree.归纳步骤:向树中添加一个节点。 There are two cases:有两种情况:

    a) The new node is connected to a node which was previously not a leaf. a) 新节点连接到以前不是叶子的节点。

    b) The new node is connected to a node which was previously a leaf. b) 新节点连接到以前是叶子的节点。

    It is not too difficult to prove that the output of the algorithm is correct in both cases.证明算法的输出在两种情况下都是正确的并不难。 Thus the algorithm is correct for all trees.因此该算法对所有树都是正确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM