SlideShare a Scribd company logo
1 of 65
Download to read offline
Maximum Flows by
Incremental Breadth–First Search
Introduction

• 最大フローの計算

 – 典型的な最適化問題
 – いろんなところで使われている

• 最小カット
 – コンピュータビジョン(Graph cuts)では重要なツール
   • Segmentation
   • Stereo
   • Multiview reconstruction
Graph cuts

• 画像に対応するグリッドグラフ
 – s,tは全頂点と接続



• BKアルゴリズム
 – Boykov & Kolmogorov
 – 実用的に高速だが…
 – 多項式時間での上界は知られていない


  指数時間かかるような例は知られていないが
  ビジョン以外のグラフでは実用的ではない
Theoretical point of view


        • augmenting path
          – Ford-Fulkerson
          – Edmonds-Karp

        • network simplex

        • blocking flow (Dinic)

        • push-relabel
Fast!
Practical point of view



• blocking flow (Dinic)
                          汎用に高速
• push-relabel



• visionのグラフでは
  – BKが実用的
In this paper…

• BK + shortest augmentation path

  – blocking flow (Dinic)とよく似たアルゴリズム

     • 補助ネットワークの構築がボトルネック
  – Incremental mannerにより低コストで
    補助ネットワークを構築
     • BKのように両方向から構築


       Incremental Breadth First Search
                   (IBFS)
Definitions and Notation




• 割愛
 – 必要ならばその都度定義
BKアルゴリズム


– Growth
– Augment
– Adoption




s            t
BKアルゴリズム - growth




s                   t
BKアルゴリズム - growth




s                   t
BKアルゴリズム - growth




s                   t
BKアルゴリズム - growth




s                   t
BKアルゴリズム - augment




s                    t
BKアルゴリズム - augment

           orphans




s                    t




      飽和
BKアルゴリズム - adoption

Orphan頂点v の親を探す
  vと接続する残余容量が正の辺(u,v)



  s        v                t


           u            v
BKアルゴリズム - adoption

Orphan頂点v の親を探す
  vと接続する残余容量が正の辺(u,v)



  s        v                          t


           u                 v



               親が見つかった!!   親が見つからなかった
                                 Free頂点になる
BKアルゴリズム

• augmenting pathの一種

  – 見つかるパスは最短ではない

  – 多項式時間での上界は不明
IBFS overview

• 探索木S,Tを幅優先木として保持
                                         ≃ 木の高さ
      – s,tからの距離をDs, Dt
      – 探索木Sの頂点のsからの距離はDs以下
������������ = ������������ =2




       s                                      t




   ������ = ������������ + ������������ + 1   augmenting pathの長さの下界
各頂点の取りうる値

•   S-vertex
•   T-vertex
•   S-orphan
•   T-orphan
•   N-vertex



     s           t
IBFS overview

• ������������ (������) : 頂点������ ∈ ������ のラベル
• ������������ (������) : 頂点������ ∈ ������ のラベル

                               dt  2   dt  1



   s                                             t




        ds  1   ds  2
IBFS overview

• ラベルの有効性
     – 残余辺(������, ������)について������������ ������ ≤ ������������ ������ + 1
     – T側は対称

• ������������������������������������������������������������ ������������������ (������, ������)
     – S側 : 残余辺(������, ������)について������������ ������ = ������������ ������ − 1
     – T側 : 残余辺(������, ������)について������������ ������ = ������������ ������ − 1



                           ds  1        ds  2
IBFS : Initially

•   ������ = ������ , ������ = ������
•   ������������������������������������ ������������������������ = ������, ������
•   ������������ ������ = ������������ ������ = 0
•   ������������ = ������������ = 0



      s                              t




• 探索木Sを成長させると仮定
IBFS : growth

 • 探索木Sを1段階成長させる



 • ������������ ������ = ������������ の頂点������をすべてactiveに

Ds  2               a


     s      a        a               t


                     a

          ds  1   ds  2
IBFS : growth

 • active頂点������を選択して残余辺 ������, ������ を調べる
    – 頂点������がN-vertexなら
         • ������ ������ = ������
         • ������������ ������ = ������������ + 1


Ds  2                   v
                         a        w


     s        a          a        w      t


                         a

           ds  1     ds  2    ds  3
IBFS : growth

 • active頂点������を選択して残余辺 ������, ������ を調べる
    – 頂点������がT-vertexなら
         • augmentationへ



Ds  2               v
                     a      w


     s      a        a              t


                     a

          ds  1   ds  2
IBFS : augmentation

• BKと同じ
  – 見つかったパスにフローを流す
      • 最短s-tパスが見つかる(あとあと証明)



              v
              a    w


  s      a    a                t


              a
IBFS : adoption

• bridge(������, ������)以外の辺が飽和
  – orphanが誕生

• orphanの親を探す

             v
             a     w


  s                       t
IBFS : adoption

• orphan頂点������の親を探す
  – ������������ ������ = ������������ ������ − 1となる残余辺(������, ������)を探す
     • ������ ������ = ������
     • ������をS-vertexに

                orphan
                   v

                               ������は同じラベルをもつ
         u
                                 S-vertexになる


       ds  1   ds  2
IBFS : adoption

• orphan-relabel
  – 残余辺(������, ������)の中で������������ ������ が一番小さい頂点������を探す
     • そんな������が存在しない or ������������ (������) > ������������
         – ������をN-vertexにして������の子をS-orphanに
  – ������ ������ = ������, ������������ ������ = ������������ ������ + 1
  – ������をS-vertexに, ������の子をS-orphanに

     ds  8                             ������������ (������)をなるべく小さく
                                    = s-vパスの長さをなるべく短く
     ds  3            v   orphan

                       ds  4
     ds  6                         親としてorphanを選んでもいい?
              orphan
IBFS


• ループが終了したとき、ラベル������������ + 1をもつ頂点が…
  – 存在する
    • ������������ += 1 して次のループへ


  – 存在しない
    • 終わり
For efficiency


• ������������������������������������������ ������������������
     – どの辺までscanしたかを記憶
          • ラベルが変わったとき                       先頭に戻す
          • N-vertexが木に加えられたとき


                              Scan済み


                               current arc
                          v    こっからscan
4.1

CORRECTNESS AND
RUNNING TIME
         Sを成長させたと仮定
Lemma 1

 • (������, ������)が残余辺ならば…
    1. ������ ∈ ������, ������������ ������ ≤ ������������ ������������������ ������ ∉ ������ → ������はactiveなS-vertex
    2. ������ ∈ ������, ������ ∉ ������ → ������������ ������ = ������������
    3. ������������ の増加後に������ ∈ ������ ������������������ ������ ∉ ������ → ������������ ������ = ������������


Ds  2                a


     s       a        a                                   t


                      a

          ds  1   ds  2
Lemma1 証明 : 帰納法

• 最初のループ(基底)
 – 成り立つ

• 一つ前のループで成り立ってると仮定
 – 次のループの初期状態では
   • ������������ ������ = ������������ となる頂点������をすべてactiveにする
      – ラベルを変えてないので(2)(3)は成り立つ
      – (1)も成り立つ
Lemma1 証明 : 帰納法


• Growth step on ������ without augmentation
  – 頂点������はinactiveに
  – 残余辺(������, ������)をすべてscan & 全ての������をS-vertexに
        (1)は成り立つ


  – Tには何も影響がない
        (2)は成り立つ
                           u
Lemma1 証明 : 帰納法

• Augmentation Step
  – (������, ������)が飽和 Lemma1は適用できなくなる
  – augmentにより新たな残余辺 ������, ������ , ������ ∈ ������が誕生する可能性
      • (������, ������)が飽和してるときに(������, ������)にフローを流した

  – ������ = ������(������)
                                            v
      • ������ ∈ ������なら当然v ∈ ������でないと
             (1)は適用できない             s


                                            u
  – 逆(対称)の議論をすれば
      • 新たに誕生した残余辺について(2)は適用できない(������, ������ ∈ ������)
Lemma1 証明 : 帰納法

• Orphan-relabel(adoption) step
  – 頂点������が������から消えることも…

    • ������ ∈ ������, ������������ (������) ≤ ������������ となる残余辺(������, ������)が存在すれば
       – Orphan-relabelにより������はS-vertex
                  (1)は成り立つ



    • 逆(対称)の議論により
                  (2)は成り立つ
Lemma1 証明 : 帰納法

• There are no active vertex
  – ������ ∈ ������, ������ ∉ ������となる残余辺(������, ������)は…
     • ������������ (������) > ������������ のときだけ(������������ ������ = ������������ + 1)


  – 木を1段階成長させる
     • ������������ + +
     • ������������ ������ = ������������

               (3)は成り立つ
Lemma2

1. 頂点������ ∈ ������ ∪ ������は有効なラベル������������ , ������������ をもつ
2. ・各頂点������ ∈ ������について、������の������������������������������������������ ������������������は
    ������へ入る最初の������������������������������������������������������������ ������������������に等しいか先行する
   ・各頂点������ ∈ ������について、������の������������������������������������������ ������������������は
    ������から出る最初の������������������������������������������������������������ ������������������に等しいか先行する
3. ・ ������ ∈ ������なら(������ ������ , ������)は������������������������������������������������������������
   ・ ������ ∈ ������なら ������, ������ ������ は������������������������������������������������������������
4. 各頂点������について、ラベル������������ ������ , ������������ ������ は減少しない
Lemma2 証明


• 最初のループ(基底)
 – 成り立つ

• 一つ前のループで成り立ってると仮定
 – 次のループを考える
Lemma2 証明

• Growth step on ������ that add a new vertex ������ to ������
  – ������������ ������ = ������������ ������ + 1 = ������������ + 1    highest possible label
                (3),(4)は成り立つ


  – 各残余辺 ������, ������ , ������ ∈ ������について
     • Lemma1(1)より������は������������������������������������
                                       d s ( w)  Ds  d s (v)  1
     • Activeな頂点のラベルは������������
                                                  (1)は成り立つ
                                                  u
  – ������の������������������������������������������ ������������������は������の最初の辺
                (2)は成り立つ                          w            v

                                                  w
Lemma2 証明

• Augmentation step
  – ラベルを変えない                   (4)は成り立つ


  – ������ ������ , ������ にフローを流すと新たな残余辺(������, ������ ������ )が誕生
    • 帰納法の仮定(3)より ������ ������ , ������ は������������������������������������������������������������
         – (������, ������ ������ )は������������������������������������������������������������になりえない   (2)は成り立つ
    • ������������ ������ ������   = ������������ ������ − 1          (1)は成り立つ


  – ������ ������ , ������ にフローを流して飽和させた
    • ������������������������������������������������������������でなくなる
         – ������は������������������ℎ������������になる
                        (3)は適用不可
Lemma2 証明

• Adoption step on ������
  – 最初のscanではラベルを変えない                                        (1)(4)は成り立つ


  – ������������������������������������������ ������������������からはじめる
      • 帰納法の仮定(2)より最初の������������������������������������������������������������ ������������������ (������������ ������)が見つかる

      • ������の親がみつかったとき
          – ������ ������ , ������ は������������������������������������������������������������
          – ������の������������������������������������������ ������������������は最初の������������������������������������������������������������ ������������������
                        (2)(3)は成り立つ
Lemma2 証明

• Orphan-relabel
  – 残余辺(������, ������)の中で������������ (������)が最小となる������を探す
     • ラベルは有効
     • ������ ������ , ������ は������������������������������������������������������������                          (1)(2)(3)は成り立つ
     • ������の������������������������������������������ ������������������は最初の������������������������������������������������������������ ������������������


  – 帰納法の仮定(1)より
     • ラベルの有効性により頂点のラベルは減少しない
                       (4)は成り立つ
correctness



• ������������������������������������頂点がなくなって木を成長させたとき
  – ラベル������������ + 1をもつ頂点が存在しないとき

  – Lemma1-(3?)により頂点������ ∈ ������, ������ ∉ ������の間に
    残余辺(������, ������)は存在しない
    • そのときのフロー = 最大フロー
ふたつの補題

• Lemma3
  – In growth step…
     • 各頂点������ ∈ ������について、������-������パスは最短パス
     • 各頂点������ ∈ ������について、������-������パスは最短パス


• Lemma4
  – ������ = ������������ + ������������ + 1は������������������������������������������������������������ ������������������ℎの長さの下界
  – アルゴリズムは常に最短パスに沿ってフローを流す
Lemma5




• ������������������ℎ������������-������������������������������������������によりラベルは増加する
Lemma5 : 証明

• ������������������ℎ������������ ������ ∈ ������の������������������ℎ������������-������������������������������������������を考える
    – ������ = {������|������ ∈ ������, ������, ������ が残余辺}

    – Lemma2-(2)より
      ������の������������������������������������������ ������������������は������������������������������������������������������������ ������������������に先行か等しい

    – ������������������ℎ������������-������������������������������������������をしてるってことは…
        • 最初のscanで������������������������������������������������������������ ������������������を見つけられなかった

        • ������への������������������������������������������������������������ ������������������が存在しない
Lemma5 : 証明

• Lemma2-(1)よりラベルは有効
   – 各頂点������ ∈ ������について������������ ������ ≥ ������������ ������ − 1
                                    ������������������������������������������������������������ ������������������が存在しないので
   – ������������ ������ ≥ ������������ ������



• ������������������ℎ������������-������������������������������������������により������の親が見つかれば…
   – ������������ ′ ������ = ������������ ������ + 1 > ������������ ������
Lemma5 : 証明

• ������������������ℎ������������-������������������������������������������により������が������から取り除かれた(N-vertex)
   – ������������ ′ ������ : そのときのラベル

   – ������はのちのち������ ∈ ������の������������������������������ℎにより������に再度取り込まれるかも
      • ������ ∈ ������ならLemma2より������������ (������)は減少しないので
         – ������が������に再度取り込まれたときは������������ ������ > ������������ ′ ������
• ������ ∉ ������のとき
  – (������, ������)は������が������から取り除かれたあとに残余辺になった

  – ������, ������ , ������ ∉ ������にフローを流した
     • ������ ∉ ������のときだけ


  – Wもある時点でSから取り除かれ再度Sに取り込まれた
     • ������������ ������ = ������������ + 1 ≥ ������������ ′(������)

  – Lemma2より������������ (������)は減少しないので
                                 ′
     • ������������ ������ = ������������ ������ + 1 ≥ ������������ ������ + 1
Lemma6 : IBFSの計算量




• IBFS runs in ������ ������2 ������ time
Lemma6 : 証明



• 3つのoperation
  – Growth step with augmentation
  – Growth step without augmentation
  – Adoption step
Lemma6 : 証明

• Growth step on ������ without augmentation
  – ������のすべての辺をscanすれば������は������������������������������������������������になる
  – ラベルが変われば(増えれば)������は再度������������������������������������になる

  – 1ラベルにつき������������������������������������(������)の辺をscanする
  – 異なるラベルの数はn-1



        O( deg ree(v)  (n  1))  O(nm)
            v
Lemma6 : 証明

• Adoption step on ������
  – Lemma5とLemma2-(4)により
     • ������������������ℎ������������-������������������������������������������後にラベルは増加し、その後も減少しない

  – 1ラベルにつき各辺(������, ������)を2回scan
     • ������������������ℎ������������-������������������������
     • ������������������ℎ������������-������������������������������������������
  – 異なるラベルの数はn-1

                                    O(nm)
Lemma6 : 証明

• Growth step on ������ with augmentation
  – Find s-t path
  – Run augment



  – ������へのパスを見つけるために������から出る辺をscan
     • 前回augmentに使った辺を覚えておけば            前回のaugment
                                        に使った
       辺のscanは1ラベルにつき1回                  こっからscan
                                  ������
            withoutのとき同様に O(nm)
Lemma6 : 証明

• Growth step on ������ with augmentation
  – Augmentationの実行
     • 1回のaugmentationは������(������)

  – ������が������������������������������������な間は
     • (������, ������)が再度飽和することはない
         – 1ラベルにつき ������, ������ の飽和は1回


  – 異なるラベルの数はn-1                 O(nm)
  – ������へのパスを見つけるために������から出る辺をscanも含むので
                             2
                         O ( n m)
5

VARIANTS OF IBFS
Variants of IBFS

• 2つのバージョンを簡単に紹介
 – Blocking flow version
 – Delayed version

 – 事前実験によると
    • 定数ファクターが大きくて通常versionよりやや遅い
    • 理論的観点では興味深い
    • より詳細な実験・評価をする価値はある
Blocking flow version

• Growth stepのはじめに
  – ������������������������������������������������ ������������������������を得られる補助ネットワークを構築可能


      • ������, ������が同じ木に属する������������������������������������������������������������ ������������������ (������, ������)
      • 残余辺 ������, ������ ������ ∈ ������, ������ ∈ ������
                                                によって誘導されるグラフ

  – ������������������ℎ������������-������������������������������������������を遅らせることで������������������������������������������������ ������������������������アルゴリズム
      • ������������������ℎ������������になったら同じレベルの頂点との接続を試みる
          – ラベル(s/tからの距離)は増加
      • 失敗したら������������������ℎ������������になる(������������������������������������������をしない)
      • growth/augmentのあとに������������������ℎ������������-������������������������������������������を実行
Delayed version

• IBFSでは有益な情報を無視している
 – 例えば ������������ = ������������ = 10, ������ = 21のとき
    • ������������ ������ = 2の頂点������ ∈ ������について

    • ������から������への距離の下界は19(21 − 2)

    • ������������������ℎ������������-������������������������������������������により������������ ������ = 5となった
                 L=5+19=24になるまで
                 ������の処理を遅らせる

    • ������からのみ到達可能な頂点も無視される

     IBFSと比べて複雑だがよりよい状態遷移が起こるかも
6

EXPERIMENTAL RESULTS
Implementation Details

• S,Tを同時に成長させる
  – 見つかるaugmenting pathが最短でなくなることも
    (shortest+1)
  – S内でのs-vパス, T内でのw-tパスは共に最短
    • 解析は有効
  – 実験したらこの方がすこし速かった

• Low-levelな最適化をいくつか行った
  – 公平を期すためBKにも同じ最適化を施した(UBK)
    • BKより20%ほど速くなった
Augmenting   Growth stepでの          rootまでを

result   pathの長さの総和   辺をscanした回数             Traverseした回数
                                   Orphanが
                                   辺をscanした回数




                        全体的にIBFSの方が少し高速




                        IBFSはロバスト
Concluding Remarks

• Incremental BFSを提案
  – BKよりロバストで実用的

• Aroraらが新たなpush-relabelアルゴリズムを提案
  – Voronoi push-relabel (2010, ECCV)
  – 多項式時間アルゴリズムでBKよりも優れている
  – コードが公開されてないので直接比較出来なかったが…
    • IBFSよりも高速?


• Delayed versionは研究する必要がある

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Maximum flows by ibfs

  • 1. Maximum Flows by Incremental Breadth–First Search
  • 2. Introduction • 最大フローの計算 – 典型的な最適化問題 – いろんなところで使われている • 最小カット – コンピュータビジョン(Graph cuts)では重要なツール • Segmentation • Stereo • Multiview reconstruction
  • 3. Graph cuts • 画像に対応するグリッドグラフ – s,tは全頂点と接続 • BKアルゴリズム – Boykov & Kolmogorov – 実用的に高速だが… – 多項式時間での上界は知られていない 指数時間かかるような例は知られていないが ビジョン以外のグラフでは実用的ではない
  • 4. Theoretical point of view • augmenting path – Ford-Fulkerson – Edmonds-Karp • network simplex • blocking flow (Dinic) • push-relabel Fast!
  • 5. Practical point of view • blocking flow (Dinic) 汎用に高速 • push-relabel • visionのグラフでは – BKが実用的
  • 6. In this paper… • BK + shortest augmentation path – blocking flow (Dinic)とよく似たアルゴリズム • 補助ネットワークの構築がボトルネック – Incremental mannerにより低コストで 補助ネットワークを構築 • BKのように両方向から構築 Incremental Breadth First Search (IBFS)
  • 7. Definitions and Notation • 割愛 – 必要ならばその都度定義
  • 14. BKアルゴリズム - augment orphans s t 飽和
  • 15. BKアルゴリズム - adoption Orphan頂点v の親を探す vと接続する残余容量が正の辺(u,v) s v t u v
  • 16. BKアルゴリズム - adoption Orphan頂点v の親を探す vと接続する残余容量が正の辺(u,v) s v t u v 親が見つかった!! 親が見つからなかった Free頂点になる
  • 17. BKアルゴリズム • augmenting pathの一種 – 見つかるパスは最短ではない – 多項式時間での上界は不明
  • 18. IBFS overview • 探索木S,Tを幅優先木として保持 ≃ 木の高さ – s,tからの距離をDs, Dt – 探索木Sの頂点のsからの距離はDs以下 ������������ = ������������ =2 s t ������ = ������������ + ������������ + 1 augmenting pathの長さの下界
  • 19. 各頂点の取りうる値 • S-vertex • T-vertex • S-orphan • T-orphan • N-vertex s t
  • 20. IBFS overview • ������������ (������) : 頂点������ ∈ ������ のラベル • ������������ (������) : 頂点������ ∈ ������ のラベル dt  2 dt  1 s t ds  1 ds  2
  • 21. IBFS overview • ラベルの有効性 – 残余辺(������, ������)について������������ ������ ≤ ������������ ������ + 1 – T側は対称 • ������������������������������������������������������������ ������������������ (������, ������) – S側 : 残余辺(������, ������)について������������ ������ = ������������ ������ − 1 – T側 : 残余辺(������, ������)について������������ ������ = ������������ ������ − 1 ds  1 ds  2
  • 22. IBFS : Initially • ������ = ������ , ������ = ������ • ������������������������������������ ������������������������ = ������, ������ • ������������ ������ = ������������ ������ = 0 • ������������ = ������������ = 0 s t • 探索木Sを成長させると仮定
  • 23. IBFS : growth • 探索木Sを1段階成長させる • ������������ ������ = ������������ の頂点������をすべてactiveに Ds  2 a s a a t a ds  1 ds  2
  • 24. IBFS : growth • active頂点������を選択して残余辺 ������, ������ を調べる – 頂点������がN-vertexなら • ������ ������ = ������ • ������������ ������ = ������������ + 1 Ds  2 v a w s a a w t a ds  1 ds  2 ds  3
  • 25. IBFS : growth • active頂点������を選択して残余辺 ������, ������ を調べる – 頂点������がT-vertexなら • augmentationへ Ds  2 v a w s a a t a ds  1 ds  2
  • 26. IBFS : augmentation • BKと同じ – 見つかったパスにフローを流す • 最短s-tパスが見つかる(あとあと証明) v a w s a a t a
  • 27. IBFS : adoption • bridge(������, ������)以外の辺が飽和 – orphanが誕生 • orphanの親を探す v a w s t
  • 28. IBFS : adoption • orphan頂点������の親を探す – ������������ ������ = ������������ ������ − 1となる残余辺(������, ������)を探す • ������ ������ = ������ • ������をS-vertexに orphan v ������は同じラベルをもつ u S-vertexになる ds  1 ds  2
  • 29. IBFS : adoption • orphan-relabel – 残余辺(������, ������)の中で������������ ������ が一番小さい頂点������を探す • そんな������が存在しない or ������������ (������) > ������������ – ������をN-vertexにして������の子をS-orphanに – ������ ������ = ������, ������������ ������ = ������������ ������ + 1 – ������をS-vertexに, ������の子をS-orphanに ds  8 ������������ (������)をなるべく小さく = s-vパスの長さをなるべく短く ds  3 v orphan ds  4 ds  6 親としてorphanを選んでもいい? orphan
  • 30. IBFS • ループが終了したとき、ラベル������������ + 1をもつ頂点が… – 存在する • ������������ += 1 して次のループへ – 存在しない • 終わり
  • 31. For efficiency • ������������������������������������������ ������������������ – どの辺までscanしたかを記憶 • ラベルが変わったとき 先頭に戻す • N-vertexが木に加えられたとき Scan済み current arc v こっからscan
  • 32. 4.1 CORRECTNESS AND RUNNING TIME Sを成長させたと仮定
  • 33. Lemma 1 • (������, ������)が残余辺ならば… 1. ������ ∈ ������, ������������ ������ ≤ ������������ ������������������ ������ ∉ ������ → ������はactiveなS-vertex 2. ������ ∈ ������, ������ ∉ ������ → ������������ ������ = ������������ 3. ������������ の増加後に������ ∈ ������ ������������������ ������ ∉ ������ → ������������ ������ = ������������ Ds  2 a s a a t a ds  1 ds  2
  • 34. Lemma1 証明 : 帰納法 • 最初のループ(基底) – 成り立つ • 一つ前のループで成り立ってると仮定 – 次のループの初期状態では • ������������ ������ = ������������ となる頂点������をすべてactiveにする – ラベルを変えてないので(2)(3)は成り立つ – (1)も成り立つ
  • 35. Lemma1 証明 : 帰納法 • Growth step on ������ without augmentation – 頂点������はinactiveに – 残余辺(������, ������)をすべてscan & 全ての������をS-vertexに (1)は成り立つ – Tには何も影響がない (2)は成り立つ u
  • 36. Lemma1 証明 : 帰納法 • Augmentation Step – (������, ������)が飽和 Lemma1は適用できなくなる – augmentにより新たな残余辺 ������, ������ , ������ ∈ ������が誕生する可能性 • (������, ������)が飽和してるときに(������, ������)にフローを流した – ������ = ������(������) v • ������ ∈ ������なら当然v ∈ ������でないと (1)は適用できない s u – 逆(対称)の議論をすれば • 新たに誕生した残余辺について(2)は適用できない(������, ������ ∈ ������)
  • 37. Lemma1 証明 : 帰納法 • Orphan-relabel(adoption) step – 頂点������が������から消えることも… • ������ ∈ ������, ������������ (������) ≤ ������������ となる残余辺(������, ������)が存在すれば – Orphan-relabelにより������はS-vertex (1)は成り立つ • 逆(対称)の議論により (2)は成り立つ
  • 38. Lemma1 証明 : 帰納法 • There are no active vertex – ������ ∈ ������, ������ ∉ ������となる残余辺(������, ������)は… • ������������ (������) > ������������ のときだけ(������������ ������ = ������������ + 1) – 木を1段階成長させる • ������������ + + • ������������ ������ = ������������ (3)は成り立つ
  • 39. Lemma2 1. 頂点������ ∈ ������ ∪ ������は有効なラベル������������ , ������������ をもつ 2. ・各頂点������ ∈ ������について、������の������������������������������������������ ������������������は ������へ入る最初の������������������������������������������������������������ ������������������に等しいか先行する ・各頂点������ ∈ ������について、������の������������������������������������������ ������������������は ������から出る最初の������������������������������������������������������������ ������������������に等しいか先行する 3. ・ ������ ∈ ������なら(������ ������ , ������)は������������������������������������������������������������ ・ ������ ∈ ������なら ������, ������ ������ は������������������������������������������������������������ 4. 各頂点������について、ラベル������������ ������ , ������������ ������ は減少しない
  • 40. Lemma2 証明 • 最初のループ(基底) – 成り立つ • 一つ前のループで成り立ってると仮定 – 次のループを考える
  • 41. Lemma2 証明 • Growth step on ������ that add a new vertex ������ to ������ – ������������ ������ = ������������ ������ + 1 = ������������ + 1 highest possible label (3),(4)は成り立つ – 各残余辺 ������, ������ , ������ ∈ ������について • Lemma1(1)より������は������������������������������������ d s ( w)  Ds  d s (v)  1 • Activeな頂点のラベルは������������ (1)は成り立つ u – ������の������������������������������������������ ������������������は������の最初の辺 (2)は成り立つ w v w
  • 42. Lemma2 証明 • Augmentation step – ラベルを変えない (4)は成り立つ – ������ ������ , ������ にフローを流すと新たな残余辺(������, ������ ������ )が誕生 • 帰納法の仮定(3)より ������ ������ , ������ は������������������������������������������������������������ – (������, ������ ������ )は������������������������������������������������������������になりえない (2)は成り立つ • ������������ ������ ������ = ������������ ������ − 1 (1)は成り立つ – ������ ������ , ������ にフローを流して飽和させた • ������������������������������������������������������������でなくなる – ������は������������������ℎ������������になる (3)は適用不可
  • 43. Lemma2 証明 • Adoption step on ������ – 最初のscanではラベルを変えない (1)(4)は成り立つ – ������������������������������������������ ������������������からはじめる • 帰納法の仮定(2)より最初の������������������������������������������������������������ ������������������ (������������ ������)が見つかる • ������の親がみつかったとき – ������ ������ , ������ は������������������������������������������������������������ – ������の������������������������������������������ ������������������は最初の������������������������������������������������������������ ������������������ (2)(3)は成り立つ
  • 44. Lemma2 証明 • Orphan-relabel – 残余辺(������, ������)の中で������������ (������)が最小となる������を探す • ラベルは有効 • ������ ������ , ������ は������������������������������������������������������������ (1)(2)(3)は成り立つ • ������の������������������������������������������ ������������������は最初の������������������������������������������������������������ ������������������ – 帰納法の仮定(1)より • ラベルの有効性により頂点のラベルは減少しない (4)は成り立つ
  • 45. correctness • ������������������������������������頂点がなくなって木を成長させたとき – ラベル������������ + 1をもつ頂点が存在しないとき – Lemma1-(3?)により頂点������ ∈ ������, ������ ∉ ������の間に 残余辺(������, ������)は存在しない • そのときのフロー = 最大フロー
  • 46. ふたつの補題 • Lemma3 – In growth step… • 各頂点������ ∈ ������について、������-������パスは最短パス • 各頂点������ ∈ ������について、������-������パスは最短パス • Lemma4 – ������ = ������������ + ������������ + 1は������������������������������������������������������������ ������������������ℎの長さの下界 – アルゴリズムは常に最短パスに沿ってフローを流す
  • 48. Lemma5 : 証明 • ������������������ℎ������������ ������ ∈ ������の������������������ℎ������������-������������������������������������������を考える – ������ = {������|������ ∈ ������, ������, ������ が残余辺} – Lemma2-(2)より ������の������������������������������������������ ������������������は������������������������������������������������������������ ������������������に先行か等しい – ������������������ℎ������������-������������������������������������������をしてるってことは… • 最初のscanで������������������������������������������������������������ ������������������を見つけられなかった • ������への������������������������������������������������������������ ������������������が存在しない
  • 49. Lemma5 : 証明 • Lemma2-(1)よりラベルは有効 – 各頂点������ ∈ ������について������������ ������ ≥ ������������ ������ − 1 ������������������������������������������������������������ ������������������が存在しないので – ������������ ������ ≥ ������������ ������ • ������������������ℎ������������-������������������������������������������により������の親が見つかれば… – ������������ ′ ������ = ������������ ������ + 1 > ������������ ������
  • 50. Lemma5 : 証明 • ������������������ℎ������������-������������������������������������������により������が������から取り除かれた(N-vertex) – ������������ ′ ������ : そのときのラベル – ������はのちのち������ ∈ ������の������������������������������ℎにより������に再度取り込まれるかも • ������ ∈ ������ならLemma2より������������ (������)は減少しないので – ������が������に再度取り込まれたときは������������ ������ > ������������ ′ ������
  • 51. • ������ ∉ ������のとき – (������, ������)は������が������から取り除かれたあとに残余辺になった – ������, ������ , ������ ∉ ������にフローを流した • ������ ∉ ������のときだけ – Wもある時点でSから取り除かれ再度Sに取り込まれた • ������������ ������ = ������������ + 1 ≥ ������������ ′(������) – Lemma2より������������ (������)は減少しないので ′ • ������������ ������ = ������������ ������ + 1 ≥ ������������ ������ + 1
  • 52. Lemma6 : IBFSの計算量 • IBFS runs in ������ ������2 ������ time
  • 53. Lemma6 : 証明 • 3つのoperation – Growth step with augmentation – Growth step without augmentation – Adoption step
  • 54. Lemma6 : 証明 • Growth step on ������ without augmentation – ������のすべての辺をscanすれば������は������������������������������������������������になる – ラベルが変われば(増えれば)������は再度������������������������������������になる – 1ラベルにつき������������������������������������(������)の辺をscanする – 異なるラベルの数はn-1 O( deg ree(v)  (n  1))  O(nm) v
  • 55. Lemma6 : 証明 • Adoption step on ������ – Lemma5とLemma2-(4)により • ������������������ℎ������������-������������������������������������������後にラベルは増加し、その後も減少しない – 1ラベルにつき各辺(������, ������)を2回scan • ������������������ℎ������������-������������������������ • ������������������ℎ������������-������������������������������������������ – 異なるラベルの数はn-1 O(nm)
  • 56. Lemma6 : 証明 • Growth step on ������ with augmentation – Find s-t path – Run augment – ������へのパスを見つけるために������から出る辺をscan • 前回augmentに使った辺を覚えておけば 前回のaugment に使った 辺のscanは1ラベルにつき1回 こっからscan ������ withoutのとき同様に O(nm)
  • 57. Lemma6 : 証明 • Growth step on ������ with augmentation – Augmentationの実行 • 1回のaugmentationは������(������) – ������が������������������������������������な間は • (������, ������)が再度飽和することはない – 1ラベルにつき ������, ������ の飽和は1回 – 異なるラベルの数はn-1 O(nm) – ������へのパスを見つけるために������から出る辺をscanも含むので 2 O ( n m)
  • 59. Variants of IBFS • 2つのバージョンを簡単に紹介 – Blocking flow version – Delayed version – 事前実験によると • 定数ファクターが大きくて通常versionよりやや遅い • 理論的観点では興味深い • より詳細な実験・評価をする価値はある
  • 60. Blocking flow version • Growth stepのはじめに – ������������������������������������������������ ������������������������を得られる補助ネットワークを構築可能 • ������, ������が同じ木に属する������������������������������������������������������������ ������������������ (������, ������) • 残余辺 ������, ������ ������ ∈ ������, ������ ∈ ������ によって誘導されるグラフ – ������������������ℎ������������-������������������������������������������を遅らせることで������������������������������������������������ ������������������������アルゴリズム • ������������������ℎ������������になったら同じレベルの頂点との接続を試みる – ラベル(s/tからの距離)は増加 • 失敗したら������������������ℎ������������になる(������������������������������������������をしない) • growth/augmentのあとに������������������ℎ������������-������������������������������������������を実行
  • 61. Delayed version • IBFSでは有益な情報を無視している – 例えば ������������ = ������������ = 10, ������ = 21のとき • ������������ ������ = 2の頂点������ ∈ ������について • ������から������への距離の下界は19(21 − 2) • ������������������ℎ������������-������������������������������������������により������������ ������ = 5となった L=5+19=24になるまで ������の処理を遅らせる • ������からのみ到達可能な頂点も無視される IBFSと比べて複雑だがよりよい状態遷移が起こるかも
  • 63. Implementation Details • S,Tを同時に成長させる – 見つかるaugmenting pathが最短でなくなることも (shortest+1) – S内でのs-vパス, T内でのw-tパスは共に最短 • 解析は有効 – 実験したらこの方がすこし速かった • Low-levelな最適化をいくつか行った – 公平を期すためBKにも同じ最適化を施した(UBK) • BKより20%ほど速くなった
  • 64. Augmenting Growth stepでの rootまでを result pathの長さの総和 辺をscanした回数 Traverseした回数 Orphanが 辺をscanした回数 全体的にIBFSの方が少し高速 IBFSはロバスト
  • 65. Concluding Remarks • Incremental BFSを提案 – BKよりロバストで実用的 • Aroraらが新たなpush-relabelアルゴリズムを提案 – Voronoi push-relabel (2010, ECCV) – 多項式時間アルゴリズムでBKよりも優れている – コードが公開されてないので直接比較出来なかったが… • IBFSよりも高速? • Delayed versionは研究する必要がある