Loading...

PPT – Dijkstra PowerPoint presentation | free to download - id: 21a34a-ZDc1Z

The Adobe Flash plugin is needed to view this content

Dijkstras algorithm

- Algorithm for finding shortest paths
- Determine shortest paths in order of node

distance from dest - closest node to dest is the neighbor of dest with

smallest link weight - second closest node is
- neighbor of dest with second smallest link

weight, or - a node two hops away, when the last hop is the

previously selected link - Method each node gets a temporary label that

estimates its distance from dest . When the

estimate is validated, the label becomes final. - Notations
- P set of nodes with final label
- Di label of node i

Dijkstra ( continued)

- Initialization
- 1. Find node for which

and

- 2. If stop.
- 3. For all , do

and return to step 1. - Lemma For every , holds
- Proof easy by induction. Step 1. Ensures that

the statement holds for each iteration. - Lemma For each , the label

gives the shortest path from i to dest on a

path whose links, except for the first, have

edges that belong to P. - Proof easy by induction. Step 3. ensures that

the statement holds for a node that enters P. - Number of calculations N-1 iterations,

operations/iteration proportional to N,

therefore total O(N2) better than

Bellman-Ford

Example of Dijkstra

Routing via Broadcast

- Problem Source node wants to transmit same

information to all nodes in the network

(broadcast) - Best performance on Spanning Tree, if one is

available, if not, easiest to flood - Flooding each node sends information to all its

neighbors - Advantages
- No need to know network structure
- No need to know network current topology
- Reliable and fast every connected node will get

the information at the earliest possible time. - Assumptions and notations
- every node knows its adjacent topology
- every node assigns local ids to its adjacent

links - MSG(info) - message carrying the information info

Routing via Broadcast (continued)

- Protocol PI ( Propagation of Information )
- Every node i performs the following algorithm (

the source node receives START) - initialization
- upon START or receipt of MSG(info)
- if m0 then
- accept info
- send MSG(info) to all neighbors
- Notes
- Protocol is completely distributed every node

works independently and upon its own schedule - The variable m makes sure that nodes will

transfer and accept information no more than

once. - Last line can be changed to
- send MSG(info) to all neighbors except the one

MSG was received from

Properties of PI

- During the operation of the protocol, exactly one

message travels on each link in each direction - All nodes connected to the source will accept the

info, exactly once - For each node i , let pi be the neighbor from

which node i receives the first MSG - The collection (i,pi) forms a Spanning Tree
- If wij is the delay on link (i,j), then the above

is the tree of shortest paths from source to all

other nodes - The source does not know the termination time,

i.e. some time when it can be sure that all nodes

have received the information. It knows the

information will be received and accepted by all

nodes, but it doesnt know when.

Broadcast with termination indication (PIF)

- Protocol
- Use PI-type to broadcast information and to form

Spanning Tree - Use Spanning Tree to collect termination

information - Method
- node that accepts info, forwards it to all

neighbors, except pi ( the neighbor it has

received the info from ) - upon receipt of MSG from all neighbors, send info

backwards on the Spanning Tree ( towards source

). - Termination indication source receives MSG

from all its neighbors - Notations
- m flag that indicates participation in protocol
- N(l) flag that indicates that the node has

received MSG from neighbor l - p neighbor from which first MSG was received

first - receive MSG from nil START
- Above notations are for each node i and each

source s - to distinguish between nodes
- to distinguish between sources

PIF algorithm

- Every node i performs the following algorithm (

the source node receives START) - initialization
- upon receipt of from
- if then (propagation phase)
- accept info
- send to all neighbors

except l - if

then (feedback phase) - send to

- Properties
- all connected nodes will accept message exactly

once - one MSG on each link in each direction
- collection form a spanning tree

- all nodes perform and complete

protocol - each node i completes protocol before its

preferred neighbor - source node completes protocol last, and thus

this is the termination indication

Example

source

Example PIF

source

Connectivity Test

- Goal every node wants to learn what are the

nodes in its connected network - Protocol CT1
- every node sends its id in PI
- nodes wake up when they get the first message, at

which time they start their own PI - Properties
- can be started asynchronously at several nodes
- every node will receive the identity of every

other connected node - disconnected nodes will not know of each other
- a node cannot determine a termination time, i.e.

a time when it knows for sure the identities of

all connected nodes

CT2

- Idea use PIFs instead of PIs
- Protocol CT2
- A node starts its own PIF when
- gets a START
- upon receiving the first message ( of some PIF

started by another node ) - A node participates in every PIF started by other

nodes and registers every source of such a PIF - Properties
- can be started asynchronously at several nodes
- every node will receive the identity of every

other connected node - disconnected nodes will not know of each other
- a node i can determine a termination time, i.e. a

time when it knows for sure the identities of all

connected nodes . This time is

the time when i completes its own PIF. This

property follows from the fact that the broadcast

phase of reaches node i before the

feedback phase of .

CT3

- Idea same as CT1, except that nodes broadcast

their neighbors identities along with their own

identity - Properties
- all good properties of CT1
- a node has a termination signal when a

arrives, it also indicates that PIs from all

neighbors of j will also arrive. Termination

when all expected identities have arrived. - A node needs to know or find out neighbors

identities. - Additional variations on CT1, CT2, CT3
- encoded information to reduce MSG contents
- reduction of number of messages
- pruning of MSG contents