Lecture 21: Random walk and electric networks

advertisement
Randomized Algorithms
CS648
Lecture 21
Random Walk and Electric Networks
1
OVERVIEW AND MOTIVATION
2
What do we know about Random walk till now?
We have discussed uniform random walk on
• A line.
• A complete graph.
• Two complete graphs joined by an edge (Mid-sem Exam).
We analyzed the random walk by writing equation for each case. We could
solve these equations because of
• Symmetry of the our graphs (line graph, complete graph).
• Uniformity of random walk.
Question: Is there a compact formula for expected duration of a random walk
on any graph ? What if the random walk is not uniform ?
3
An answer from mathematics
Let ๐‘ฎ = (๐‘ฝ, ๐‘ฌ) be an undirected graph on ๐’ vertices and ๐’Ž edges.
Theorem: Let ๐’–, ๐’— ∈ ๐‘ฝ. Expected length of a random walk that starts from ๐’–
and terminates on reaching ๐’— is ๐‘ถ(๐’Ž๐’).
The above result is derived using theory of Markov Chains.
Unfortunately, it is a loose result for many graphs ๏Œ.
Exercise: Show that for complete graph, the above result is very loose.
4
A surprising discovery
• Random walk on a graph is closely related to electric networks.
• A graph can be viewed as a electric network where each edge corresponds
to a resistance of one ohm.
• Various aspects of random walk are defined as a fundamental
characteristics (resistance, power, voltage) of the corresponding electric
network.
Physics of electric network helps in mathematical theory of random walk !
Isn’t it surprising ?
5
A WARM UP EXAMPLE
6
Random walk on a line
½
½
home
bar
๐ŸŽ
๐Ÿ
๐’Š−๐Ÿ
๐’Š
๐’Š+๐Ÿ
๐’−๐Ÿ
๐’
Question: Suppose the random walk starts at ๐’Š. What is the probability that
the drunkard reaches home before reaching bar ?
Let ๐’‘(๐’Š) be the corresponding probability.
๐’‘ ๐ŸŽ = ?๐ŸŽ
๐’‘ ๐’ = ?๐Ÿ
๐Ÿ
๐Ÿ
๐’‘ ๐’Š =? ๐’‘ ๐’Š−๐Ÿ + ๐’‘ ๐’Š+๐Ÿ
๐Ÿ
๐Ÿ
7
Random walk on a line
current
๐Ÿ
๐ŸŽ
๐’Š−๐Ÿ
๐’Š
๐’Š+๐Ÿ
๐’−๐Ÿ
๐’
๐Ÿ Volt
Each resistance is 1 ohm.
๐‘ฝ ๐’Š : Potential at point ๐’Š.
๐‘ฝ ๐ŸŽ = ๐ŸŽ, ๐‘ฝ ๐’ = ๐Ÿ,
Current entering ๐’Š = Current leaving ๐’Š.
๏ƒจ
๐‘ฝ ๐’Š+๐Ÿ −๐‘ฝ ๐’Š
๐Ÿ
=
๐‘ฝ ๐’Š −๐‘ฝ ๐’Š−๐Ÿ
๐Ÿ
๐Ÿ
๏ƒจ ๐‘ฝ ๐’Š =๐Ÿ ๐‘ฝ ๐’Š−๐Ÿ + ๐‘ฝ ๐’Š+๐Ÿ
9
Random walk on a line
½
½
home
bar
๐ŸŽ
๐’‘ ๐ŸŽ = ๐ŸŽ,
๐Ÿ
๐’Š−๐Ÿ
๐’‘ ๐’ = ๐Ÿ,
๐’Š
๐’‘ ๐’Š =
๐’Š+๐Ÿ
๐Ÿ
๐Ÿ
๐’‘ ๐’Š−๐Ÿ
๐’−๐Ÿ
๐’
+ ๐’‘ ๐’Š+๐Ÿ
current
๐ŸŽ
๐Ÿ
๐’Š−๐Ÿ
๐’Š
๐’Š+๐Ÿ
๐’−๐Ÿ
๐’
๐Ÿ Volt
๐‘ฝ ๐’Š : Potential at point ๐’Š
๐‘ฝ ๐ŸŽ = ๐ŸŽ,
๐‘ฝ ๐’ = ๐Ÿ,
๐‘ฝ ๐’Š =
๐Ÿ
๐Ÿ
๐‘ฝ ๐’Š−๐Ÿ
+ ๐‘ฝ ๐’Š+๐Ÿ
Hence ๐‘ฝ ๐’Š and ๐’‘ ๐’Š satisfy the same set of equations.
๏ƒจ Since these equations have unique solution, therefore๐‘ฝ ๐’Š = ๐’‘ ๐’Š for all ๐’Š.
Generalization to graphs
๐’š
๐’ƒ
bar
๐’—
home
๐’„
๐’–
๐’™
๐’ˆ
๐’…
๐’‚
๐’›
Question: What is ๐’‘๐’™ , probability of reaching home before bar ?
๐’‘๐’— = ๐ŸŽ,
๐’‘๐’„ = ๐Ÿ,
๐’‘๐’™ =
๐Ÿ
deg(๐’™)
๐’š∈๐‘ต(๐’™) ๐’‘๐’š
11
Generalization to graphs
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
Question: What is relation between ๐‘ฝ๐’™ and ๐‘ฝ๐’š ’s where ๐’š ∈ ๐‘ต(๐’™) ?
๐‘ฝ๐’— = ๐ŸŽ,
๐‘ฝ๐’„ = ๐Ÿ,
Net current leaving ๐’™ is 0.
๐’š∈๐‘ต(๐’™)(๐‘ฝ๐’™ −๐‘ฝ๐’š ) =0
๏ƒจ๐‘ฝ๐’™ =
๐Ÿ
deg(๐’™)
๐’š∈๐‘ต(๐’™) ๐‘ฝ๐’š
12
Generalization to graphs
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
Question: What is relation between ๐‘ฝ๐’™ and ๐‘ฝ๐’š ’s where ๐’š ∈ ๐‘ต(๐’™) ?
๐‘ฝ๐’— = ๐ŸŽ,
๐‘ฝ๐’„ = ๐Ÿ,
๐Ÿ
๐‘ฝ๐’™ =
deg(๐’™)
๐’‘๐’— = ๐ŸŽ,
๐’‘๐’„ = ๐Ÿ,
๐‘ฝ๐’š
๐’š∈๐‘ต(๐’™)
๐Ÿ
๐’‘๐’™ =
deg(๐’™)
๐’‘๐’š
๐’š∈๐‘ต(๐’™)
Hence ๐‘ฝ๐’™ and ๐’‘๐’™ satisfy the same set of equations.
๏ƒจ Since these equations have unique solution, therefore ๐‘ฝ๐’™ = ๐’‘๐’™ for all ๐’™.
13
Generalization to graphs
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
Exercise: Use your knowledge of electric circuits to find exact value of ๐‘ฝ๐’™ in the above
circuit. This will also be the value of ๐’‘๐’™ .
Try to realize that you would not have been able to calculate ๐’‘๐’™ using other
mathematical tools that you are aware of.
Isn’t it surprising.
Fully internalize it before proceed further for another more surprising result. We shall
revise the theory of electric circuits which perhaps you might have forgotten by now.
14
REVISITING
THEORY OF ELECTRIC CIRCUITS
15
Kirchoff’s Current Law
๐’š
๐’ƒ
๐’™
๐’–
๐’‚
๐’›
For any node ๐’™ in the circuit,
Current entering node ๐’™ = Current leaving node ๐’™
Note: This law holds for the entire circuit as well. For example,
Let the above circuit is connected to outside circuit through wires at nodes ๐’–, ๐’ƒ, ๐’›.
Question: If 5 Amperes of current enters ๐’ƒ and 10 Amperes of current enters ๐’› from
outside, then what current leaves/enters ๐’– ?
Answer: 15 Amperes of current must leave ๐’–.
17
Notion of Resistance and Ohm’s Law
๐‘ฐ
๐’‚
๐‘น
๐’ƒ
The current ๐‘ฐ passing through a piece of wire is proportional to the potential
difference ๐‘ฝ applied across the two ends of it. The constant of proportionality is called
“resistance”.
๐‘ฝ = ๐‘ฐ๐‘น
Thus the resistance can be defined in terms of voltage and current as follows.
The resistance of a wire is the potential difference that needs to be applied across its
ends to pass a current of 1 ampere through it.
18
Notion of Resistance and Ohm’s Law
๐Ÿ๐›€
๐Ÿ๐›€
๐Ÿ๐›€
๐’‚
๐Ÿ๐›€
๐Ÿ๐›€
๐’ƒ
What made you conclude that the resistance between ๐’‚ and ๐’ƒ is ๐Ÿ‘. ๐Ÿ‘๐Ÿ‘๐›€ ?
• Series law
• Parallel law
This introduces the notion of effective resistance between two points ๐’‚ and ๐’ƒ in a given
circuit.
Question : In a circuit, if we increase (decrease) the value of any resistance, what will be
its effect on effective resistance between ๐’‚ and ๐’ƒ ?
Answer: the effective resistance between ๐’‚ and ๐’ƒ may only increase(decrease).
19
Notion of Resistance and Ohm’s Law
๐‘ฐ
๐’‚
๐‘น
๐’ƒ
If ๐‘ฐ amperes of current flows from ๐’‚ to ๐’ƒ, then
• ๐‘ฝ๐’‚๐’ƒ : the potential difference from ๐’‚ to ๐’ƒ or the potential of ๐’‚ relative to ๐’ƒ
•
Relation between ๐‘ฝ๐’‚๐’ƒ and ๐‘ฝ๐’ƒ๐’‚ ?
๐‘ฝ๐’‚๐’ƒ = − ๐‘ฝ๐’ƒ๐’‚
Question: What is ๐‘ฝ๐’‚๐’ƒ if ๐’‚ is not directly connected to ๐’ƒ in the circuit ?
(see next slide)
20
Electric Potential is conservative
๐’š
๐’ƒ
๐’™
๐’–
๐’‚
๐’›
Question: What is ๐‘ฝ๐’š๐’– ? (the battery and other wires not shown in the figure above)
Answer: Consider any path from ๐’š to ๐’–. ๐‘ฝ๐’š๐’– is the sum of the potential difference at
each edge on this path.
๐‘ฝ๐’š๐’– = ๐‘ฝ๐’š๐’™ + ๐‘ฝ๐’™๐’‚ + ๐‘ฝ๐’‚๐’–
= ๐‘ฝ๐’š๐’› + ๐‘ฝ๐’›๐’‚ + ๐‘ฝ๐’‚๐’–
FACT: ๐‘ฝ๐’š๐’– is path independent (electric potential is conservative).
21
Three simple principles
Fully understand these principles so that you may
apply them later on.
22
Reversibility
Let ๐‘ฐ be a valid current flow in a circuit.
Question:
Let −๐‘ฐ be a flow obtained by reversing the direction of current flow in each branch of
circuit.
is −๐‘ฐ also a valid current flow in the circuit ?
Answer: Yes.
Question: Let
• ๐‘ฝ๐’™๐’š be potential of ๐’™ relative to ๐’š for the flow ๐‘ฐ.
•
๐‘ฝ′๐’š๐’™ be potential of ๐’š relative to ๐’™ for the flow −๐‘ฐ.
What is relation between ๐‘ฝ๐’™๐’š and ๐‘ฝ′๐’š๐’™ ?
Answer: ๐‘ฝ๐’™๐’š = ๐‘ฝ′๐’š๐’™
23
Linearity of current flow
Let ๐‘ฐ′ and ๐‘ฐ′′ be any two valid current flows in a circuit.
Question: Is ๐‘ฐ′+ ๐‘ฐ′′ a valid current flow ?
Answer: Yes.
Question: Let
• ๐‘ฝ′๐’™๐’š be potential of ๐’™ relative to ๐’š for the flow ๐‘ฐ′.
•
๐‘ฝ′′๐’™๐’š be potential of ๐’™ relative to ๐’š for the flow ๐‘ฐ′′.
What is potential of ๐’™ relative to ๐’š in ๐‘ฐ′+ ๐‘ฐ′′ ?
Answer: ๐‘ฝ′๐’™๐’š +๐‘ฝ′′๐’™๐’š
24
Uniqueness
๐’š
๐’ƒ
๐’™
๐’–
๐’‚
๐’›
If we assign any assignment of potential to nodes in the above circuit, there exists a
unique and valid current flow in the circuit satisfying these potential.
However, note that, this will require that you connect external wires to allow residual
current to enter/leave a node to satisfy Kirchoff’s law.
Interestingly the converse of the above rule is also true ๏Š.
25
Uniqueness
๐’š
๐’ƒ
๐’™
๐’–
๐’‚
๐’›
If we inject and extract any arbitrary amount of current into a circuit from outside,
then provided that the current satisfies Kirchoff’s law (net current into circuit is 0), the
current distributes itself within the circuit to give a unique and valid assignment of
potentials to all nodes.
The reason behind this uniqueness principle lies in the fact that there is a set of linear
equations for each circuit on the basis of Kirchoff’s law and Ohm’s law. These
equations have a unique solution. Interested students might like to explore this fact.
But for this course, it is fine if you just understand this principle of uniqueness.
26
Random walk and electric networks
27
Notations
๐‘ฎ = (๐‘ฝ, ๐‘ฌ)
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
• Hitting time
๐‘ฏ๐’–๐’— : Expected no. of steps of the walk that starts from ๐’– and finishes as soon as it
reaches ๐’—.
Question: Any relation between ๐‘ฏ๐’–๐’— and ๐‘ฏ๐’—๐’– ? NO
• Commute time
๐‘ช๐’–๐’— : Expected no. of steps of the walk that starts from ๐’– and finishes at ๐’– after
visiting ๐’— at least once.
๐‘ช๐’–๐’— = ๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’–
28
Expressing ๐‘ฏ๐’™๐’— through a circuit
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐‘ฏ๐’™๐’— = ๐Ÿ +
๐Ÿ
deg(๐’™)
๐’›
๐’š∈๐‘ต(๐’™) ๐‘ฏ๐’š๐’—
29
Expressing ๐‘ฏ๐’™๐’— through a circuit
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
When there is no external current into ๐’™,
Question: What is relation between ๐‘ฝ๐’™๐’— and ๐‘ฝ๐’š๐’— ’s where ๐’š ∈ ๐‘ต(๐’™) ?
๐‘ฝ๐’™๐’— =
•
•
•
๐Ÿ
deg(๐’™)
๐’š∈๐‘ต(๐’™) ๐‘ฝ๐’š๐’—
๐‘ฏ๐’™๐’— = ๐Ÿ +
๐Ÿ
deg(๐’™)
๐’š∈๐‘ต(๐’™) ๐‘ฏ๐’š๐’—
An additive term of ๐Ÿ in equation of ๐‘ฏ๐’™๐’— is missing in the equation of ๐‘ฝ๐’™๐’— . Why ?
No numerical additive term appears in the equation of ๐‘ฝ๐’™๐’— because we derived it
assuming net current into ๐’™ is 0.
So in order to make the two equations similar, we need to augment the above
circuit with external wires.
30
Expressing ๐‘ฏ๐’™๐’— through a circuit
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
Let ๐‘ฐ๐’™ be the current injected into ๐’™ from outside.
Question: What be the new relation between ๐‘ฝ๐’™๐’— and ๐‘ฝ๐’š๐’— ’s where ๐’š ∈ ๐‘ต(๐’™) ?
๐‘ฐ
๐’™
๐‘ฝ๐’™๐’— = deg(๐’™)
+
๐Ÿ
deg(๐’™)
๐’š∈๐‘ต(๐’™) ๐‘ฝ๐’š๐’—
๐‘ฏ๐’™๐’— = ๐Ÿ +
๐Ÿ
deg(๐’™)
๐’š∈๐‘ต(๐’™) ๐‘ฏ๐’š๐’—
Question: What should be ๐‘ฐ๐’™ in order to equate equations of ๐‘ฝ๐’™๐’— and ๐‘ฏ๐’™๐’— ? ๐‘ฐ = deg(๐’™)
๐’™
Observation: To equate ๐‘ฝ๐’™๐’— with ๐‘ฏ๐’™๐’— for each ๐’™ ∈ ๐‘ฝ\{๐’—}, we need to inject current
of deg(๐’™) into each node ๐’™.
๏ƒจ We must extract 2๐’Ž − deg(๐’™) current from ๐’— to satisfy Kirchoff’s current law.
31
Expressing ๐‘ฏ๐’™๐’— through a circuit
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’™๐’— is the potential of ๐’™ relative to ๐’— in circuit with the following current flow ๐‘ฐ:
1. Inject deg(๐’™) current into each ๐’™ ∈ ๐‘ฝ\{๐’—},
2. Extract 2๐’Ž − deg(๐’™) current from ๐’—.
It follows from the uniqueness principle that ๐‘ฐ will be a valid current flow in the circuit.
In a similar manner, could you express ๐‘ฏ๐’™๐’– ?
32
Expressing ๐‘ฏ๐’™๐’– through a circuit
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’™๐’– is the potential of ๐’™ relative to ๐’– in circuit with the following current flow ๐‘ฐ′:
1. Inject deg(๐’™) current into each ๐’™ ∈ ๐‘ฝ\{๐’–},
2. Extract 2๐’Ž − deg(๐’™) current from ๐’–.
33
๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’– = ??
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’–๐’— = ๐‘ฝ๐’–๐’— in circuit(๐‘ฎ) with current flow ๐‘ฐ.
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
Apply principle of Reversibility
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’—๐’– = ๐‘ฝ๐’—๐’– in circuit(๐‘ฎ) with current flow ๐‘ฐ′.
34
๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’– = ??
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’–๐’— = ๐‘ฝ๐’–๐’— in circuit(๐‘ฎ) with current flow ๐‘ฐ.
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
Apply principle of Linearity
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’—๐’– = ๐‘ฝ๐’–๐’— in circuit(๐‘ฎ) with current flow −๐‘ฐ′.
35
๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’– = ??
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
๐’ˆ
๐’…
๐’‚
๐’›
๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’–
= ๐‘ฝ๐’–๐’— in circuit(๐‘ฎ) with current flow ๐‘ฐ − ๐‘ฐ′.
Question: What does the circuit(๐‘ฎ) with current flow ๐‘ฐ − ๐‘ฐ′ look like ?
Hint: External current cancels at each node except at ๐’– and ๐’—.
36
๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’– = ??
๐’š
๐’ƒ
๐’„
๐’–
๐’™
๐’—
2๐‘š
๐’‚
๐’›
2๐‘š
๐’ˆ
๐’…
๐‘ฏ๐’–๐’— + ๐‘ฏ๐’—๐’–
= ๐‘ฝ๐’–๐’— in circuit(๐‘ฎ) with 2๐‘š current entering ๐’– and 2๐‘š current leaving ๐’—.
= 2๐‘š ๐‘น๐’–๐’— , where ๐‘น๐’–๐’— is the effective resistance between ๐’– and ๐’—.
37
Theroem: Given an undirected graph ๐‘ฎ = (๐‘ฝ, ๐‘ฌ) on ๐’Ž edges, commute time
between any pair of vertices ๐’– and ๐’— is 2๐‘š ๐‘น๐’–๐’—, where ๐‘น๐’–๐’— is the effective
resistance between ๐’– and ๐’— in the circuit associated with ๐‘ฎ.
38
Commute Time of some well studied
graphs
39
Useful tips
You may use one or more of the following principles to calculate effective
resistance any pair of vertices ๐’– and ๐’—.
• Increasing resistance of some edges to infinity (equivalent to removal of
those edges) will only increase the effective resistance between ๐’– and ๐’—.
• Apply series and parallel law of resistance can be a useful tool sometimes.
• Any flow from ๐’– to ๐’— in the circuit will consume same or more amount of
power than the corresponding current flow of same value from ๐’– to ๐’—. So
effective resistance between any pair of vertices is bounded by the power
dissipated due to any flow of 1 ampere from ๐’– to ๐’— in the circuit. (This is
called the least power law)
40
Two complete graphs joined by an edge
Let ๐‘ฎ and ๐‘ฏ be two complete graphs on ๐’ vertices. We add an edge between
a vertex in ๐‘ฎ and a vertex in ๐‘ฏ. What is the maximum commute time in this
combined graph ?
41
Grid
Given ๐’-by-๐’ grid, calculate commute time between vertices ๐’– and ๐’—.
Use least power law, and distribute 1 ampere of current evenly from ๐’– to ๐’—.
๐’—
๐’–
(the solution was sketched in the lecture class)
42
Download