problem formulation
play

Problem Formulation Assumption 1 The local best solution for - PowerPoint PPT Presentation

Problem Formulation Assumption 1 The local best solution for equation (1) provides the best overall solution. Assumption 2 The derived sub-graph forms a spanning tree structure. Algorithm Optimization Vertex # Degree Weight Vertex #


  1. Problem Formulation Assumption 1 — The local best solution for equation (1) provides the best overall solution. Assumption 2 — The derived sub-graph forms a spanning tree structure.

  2. Algorithm Optimization Vertex # Degree Weight Vertex # Degree Weight Vertex # Degree Weight 4 1 4 4 1 4 4 1 4 2 2 2 1 1 1 1 1 1 3 4 3 6 1 6 1 1 1 Vertex # Degree Weight 5 3 5 Vertex # Degree Weight 2 2 2 6 1 6 2 2 2 3 4 3 3 4 3 5 3 5 5 3 5 6 1 6

  3. Algorithm Design

  4. Pseudo-code J ADE -BFS-A LGORITHM ( Matrix M ) int maxWeight ← 0; while candiateSet ≠ Ø { 1 17 int solutionSum ← 0; Matrix localSolution ← populate with 0; 2 18 Matrix input ← the input adjacency M ; int localSum ← 0; 3 19 Matrix solution ← populate with 0; Queue temp ← Ø; 4 20 VertexNode root ← null; VertexNode vroot ← candidateSet.pop; 5 21 Queue candidateSet ← Ø 6 22 temp .push( vroot ); for every v ∈ V { 7 23 vroot .setHops(0); for every v ∈ V and v ≠ vroot { 8 if v .getWeight > maxWeight { 24 maxWeight ← v .getWeight 9 25 v .setHops(∞) 10 } 26 } while temp ≠ Ø { 11 } 27 for every v ∈ V { VertexNode u ← temp .pop; 12 28 if v .getDegree ≠ 1 or v .getWeight = mWeight { if v .getDegree ≠ 1 or v .getWeight = mWeight { for every v ∈ V and v ≠ vroot { for every v ∈ V and v ≠ vroot { 13 13 29 29 if input .adjacent( v , u ) { 14 candidateSet .push( v ); 30 if v .getHops = ∞ { 15 } 31 16 } 32 v .setHops(1 + u .getHops); 33 localSolution .mark( v , u ); 34 temp .push( v ); 35 } 36 } 37 } 38 } for every v ∈ V { 39 localSum ← localSum + v .getWeight ´ v .getHops; 40 41 } 42 if localSum < solutionSum { solutionSum ← localSum 43 solution ← localSolution 44 root ← vroot 45 46 } 47 }

  5. Complexity Analysis Space Complexity InputMatrix + VertexNode [ V ] + OutputMatrix + OutputVertexNode + Queue Time Complexity Loop 7—11 + Loop 12—15 + Loop 16—47 × × × × Loop 27—38 × × × Loop 30—37 ×

Recommend


More recommend