[英]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:您的算法是正确的,但有以下限制:
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.你的算法的正确性可以用数学归纳法证明。
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.