algorithm needed for decentralized message broadcasting in an offline enviorment (by phone)
The system should allow a fast, reliable and decentralized way to broadcast a message by phone (voice or text) to a preregistered community. Messages are forwarded between membe开发者_如何学JAVArs according to predefined rules and contact lists.
The preparation phase is online:
- the "broadcaster" is opening a "mailing list"
- people join by registering with their phone number (and security phrase)
- each get a contact list of 2-4 numbers of other members (together with their security phrases).
The broadcaster initiate a message by calling his contact list. The broadcast rule is simple: when you get a call (and hear your security phrase) you listen to the message and forward it to your contact list in the same way.
My question is - how to link the members (meaning how to build their contact lists) in a way that will be optimized to:
- distribute the message quick (minimum levels of the tree)
- not more then 4 contacts in each list (better 2 or 3)
- some level of redundancy (so if a member is not available it won't cut the whole branch).
Simple answer, branch out a tree, and then have the "leaves" on each branch connect up with all of the non-leaves on the other branches.
Let me offer more explanation. Suppose that you have 15 people. Then start them off as follows:
{
1: [2, 3],
2: [4, 5],
3: [6, 7],
4: [8, 9],
5: [10, 11],
6: [12, 13],
7: [14, 15],
Then the leaves below 2 are 8, 9, 10, 11 and the leaves below 3 are 12, 13, 14, 15. So now you connect them up with:
8: [3, 6],
9: [7, 12],
10: [13, 14],
11: [15],
12: [2, 4],
13: [5, 8],
14: [9, 10],
15: [11]
}
So you have a tree below 2, and a tree below 3. And if anything is missing on the one side, it is connected to on the other.
If you increase the branching factor then you increase the portion of the tree that are leaves, which makes it even easier to make everything be multiply connected. (It also decreases the distance from root to any element.)
精彩评论