Fibonacci heaps
This presentation is the property of its rightful owner.
Sponsored Links
1 / 20

Fibonacci Heaps PowerPoint PPT Presentation


  • 61 Views
  • Uploaded on
  • Presentation posted in: General

Fibonacci Heaps. 8. 6. 2. 1. 3. 3. 1. 16. 7. 5. 6. 4. 10. 4. 2. 4. 7. 5. 3. 14. Single Source All Destinations Shortest Paths. Greedy Single Source All Destinations. Known as Dijkstra’s algorithm.

Download Presentation

Fibonacci Heaps

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Fibonacci heaps

Fibonacci Heaps


Single source all destinations shortest paths

8

6

2

1

3

3

1

16

7

5

6

4

10

4

2

4

7

5

3

14

Single Source All Destinations Shortest Paths


Greedy single source all destinations

Greedy Single Source All Destinations

  • Known as Dijkstra’s algorithm.

  • Let d(i) be the length of a shortest one edge extension of an already generated shortest path, the one edge extension ends at vertex i.

  • The next shortest path is to an as yet unreached vertex for which the d() value is least.

  • After the next shortest path is generated, some d() values are updated (decreased).


Operations on d

Operations On d()

  • Remove min.

    • Done O(n) times, where n is the number of vertices in the graph.

  • Decrease d().

    • Done O(e) times, where e is the number of edges in the graph.

  • Array.

    • O(n2) overall complexity.

  • Min heap.

    • O(nlog n + elog n) overall complexity.

  • Fibonacci heap.

    • O(nlog n + e) overall complexity.


Prim s min cost spanning tree algorithm

Prim’s Min-Cost Spanning Tree Algorithm

  • Array.

    • O(n2) overall complexity.

  • Min heap.

    • O(nlog n + elog n) overall complexity.

  • Fibonacci heap.

    • O(nlog n + e) overall complexity.


Min fibonacci heap

Min Fibonacci Heap

  • Collection of min trees.

  • The min trees need not be Binomial trees.


Node structure

Node Structure

  • Degree, Child, Data

  • Left and Right Sibling

    • Used for circular doubly linked list of siblings.

  • Parent

    • Pointer to parent node.

  • ChildCut

    • True if node has lost a child since it became a child of its current parent.

    • Set to false by remove min, which is the only operation that makes one node a child of another.

    • Undefined for a root node.


Fibonacci heap representation

A

1

4

6

5

5

2

3

7

9

9

9

4

5

8

7

6

6

8

Fibonacci Heap Representation

  • Parent and ChildCut fields not shown.


Delete thenode

Delete(theNode)

  • theNode points to the Fibonacci heap node that contains the element that is to be deleted.

  • theNode points to min element => do a delete min.

    • In this case, complexity is the same as that for delete min.


Delete thenode1

1

5

theNode

3

9

7

4

2

6

8

10

9

5

4

5

9

7

6

6

8

Delete(theNode)

Remove theNode from its doubly linked sibling list.


Delete thenode2

1

5

3

9

7

2

6

8

9

4

5

4

7

6

6

10

5

8

9

Delete(theNode)

Combine top-level list and children of theNode.


Delete thenode3

6

Delete(theNode)

1

5

10

5

3

9

7

9

2

8

9

4

5

7

6

6

8


Decreasekey thenode theamount

1

5

theNode

3

9

7

4

2

6

8

10

9

5

4

5

9

7

6

6

8

DecreaseKey(theNode, theAmount)

If theNode is not a root and new key < parent key, remove subtree rooted at theNode from its doubly linked sibling list.

Insert into top-level list.


Decreasekey thenode theamount1

1

3

7

2

6

8

9

4

5

7

6

6

8

DecreaseKey(theNode, theAmount)

0

5

10

5

9

9


Cascading cut

Cascading Cut

  • When theNode is cut out of its sibling list in a remove or decrease key operation, follow path from parent of theNode to the root.

  • Encountered nodes (other than root) with ChildCut = true are cut from their sibling lists and inserted into top-level list.

  • Stop at first node with ChildCut = false.

  • For this node, set ChildCut = true.


Cascading cut example

1

F

3

2

7

T

9

8

4

5

T

7

6

6

8

theNode

8

9

9

Cascading Cut Example

Decrease key by 2.


Cascading cut example1

Cascading Cut Example

1

6

F

3

8

9

2

7

T

9

9

8

4

5

T

7

6

6


Cascading cut example2

Cascading Cut Example

1

6

7

F

3

8

9

2

7

T

9

9

8

4

5

6

6


Cascading cut example3

Cascading Cut Example

1

6

4

7

F

3

8

9

6

2

7

9

9

8

5

6


Cascading cut example4

1

6

4

7

T

3

8

9

6

2

7

9

9

8

5

6

Cascading Cut Example

Actual complexity of cascading cut is O(h) = O(n).


  • Login