Internal Path Length: Solving the Mystery

Click For Summary

Discussion Overview

The discussion revolves around the concept of Internal Path Length (IPL) in binary trees, focusing on its meaning, calculation, and implications. Participants explore how IPL relates to the structure of the tree and the distances between nodes and the root, while addressing specific examples and calculations.

Discussion Character

  • Homework-related
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant expresses confusion about the meaning of IPL, specifically questioning how an IPL of 30 can exist in a tree with only 13 nodes.
  • Another participant explains that IPL is the sum of the distances from each node to the root, suggesting a method to visualize this by labeling nodes with their respective distances.
  • A participant challenges the explanation by pointing out a perceived discrepancy between the number of nodes and the calculated IPL, asking for clarification.
  • Further replies clarify that the IPL calculation must consider all levels of the tree, not just a subset, to arrive at the total of 30.
  • One participant proposes that the distance represented by IPL is not in terms of physical units but rather in levels or edges within the tree structure.
  • Another participant provides an analogy to illustrate the concept of IPL as a total distance traveled through the tree, emphasizing that it reflects the number of edges traversed.

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding the IPL concept, with some agreeing on its definition while others remain uncertain about the implications of the calculations and the relationship between nodes and IPL.

Contextual Notes

Participants highlight limitations in their understanding, particularly regarding the relationship between the number of nodes and the IPL value, as well as the need to account for all levels in the tree for accurate calculations.

zak100
Messages
462
Reaction score
11

Homework Statement



I can't understand the concept of internal path length. I can't understand what this value mean in the tree? For instance if a IPL of a tree is 30 then what does it mean for the tree. Tree does not have 30 nodes so what the path length means?

Li is the number of nodes in Level i

Homework Equations


Summation (i-1) * Li

The Attempt at a Solution


IPL = 30: for the attached figure(one node at level 0, two at level 1, four at level 2, four at level 3and 2 at level 4:

1 * 0+2* 1 + 4 * 2+ 4 * 3 + 2 * 4= 30.

Some body please tell me how can we see this value in the tree through nodes??

Zulfi
 

Attachments

  • IPL3.jpg
    IPL3.jpg
    12.6 KB · Views: 475
Physics news on Phys.org
The IPL is the sum, over all nodes in the tree, of the distance from each node to the root.

You can see this in a diagram by erasing the numbers written on the nodes of your tree and replacing them by the distance of the node from the root. So the root has 0, the two on the next level have 1, the four on the next level have 2, and so on. Then just add up all the numbers to get the IPL.

It's straightforward to show that that gives the same number as the formula you have written above under 'relevant equations'.

You can also think of it as follows: label the nodes of the tree as 1 to n. Then label n little robots with the numbers from 1 to n and program each robot to walk along the tree to the node with the same label as it has and stop there. Then the IPL is the total distance walked by all the little robots.
 
Hi,
Thanks for your reply. I am calculating the IPL for the tree which i have attached. IPL = 30 & there are only 13 nodes in the tree. This is discrepancy according to what you are saying
<
You can see this in a diagram by erasing the numbers written on the nodes of your tree and replacing them by the distance of the node from the root. So the root has 0, the two on the next level have 1, the four on the next level have 2, and so on. Then just add up all the numbers to get the IPL.>
If possible please show me what you are saying.

Zulfi.
 
zak100 said:
This is discrepancy according to what you are saying
I'm afraid I don't know what you mean by that. To what discrepancy are you referring? I cannot see a discrepancy.
 
Hi,
In my figure which shows a binary tree, it has only 13 nodes, but IPL is 30 (i have shown this in reply #1). According to your words, if i do labeling then root which is at level 1, it should have path length =0 which is correct but level 2, IPL is 2, and then at Level 3 IPL is 10. I mean this is a contradiction with what you are saying. Kindly guide me.

Zulfi.
 
It's not a contradiction. There are five levels. You have only done three. Why would you expect to get the IPL for the whole tree if you only include the first three levels?

Keep going until you have covered all levels and you'll get 30.
 
Hi,
I have already evaluated this 30 value in my reply#1. You say that it represents a distance.
<You can see this in a diagram by erasing the numbers written on the nodes of your tree and replacing them by the distance of the node from the root. >

Tell me what distance 30 is representing? We don't have 30 nodes. We have only 13 nodes. This means that the distance is not in terms of nodes. Also if i add up edges with nodes, i won't get 30. So 30 is not the sum of edges & nodes. So then what does this distance of 30 mean. If i say that IPL is 30 what this value would mean?

Zulfi.
 
zak100 said:
If i say that IPL is 30 what this value would mean?
I have already given you two meanings for it: one in the first paragraph of post 2 and the other in the last paragraph of post 2.

If you cannot understand those explanations then I am afraid there is nothing more that I can do to help you.
 
OK, let's start over.
We will do just the left side of the tree here.

Node 8 is the Root.
Node 3 is next. Node 3's distance from Root is 1, so node 3 is labelled '1'
Node 1 distance from Root is 2 so node 1 is labelled '2'. (Node 3 is already labelled and it has not moved, so leave it alone. It is already labelled.)
Node 5 distance from Root is 2 so node 5 is also labelled '2'. (Node 3 is already labelled, so leave it alone.)
Node 6 distance from Root is 3 so node 6 is labelled '3'. (Nodes 3 & 5 are already labelled, so leave them alone.)
Node 7 distance from Root is 4 so node 7 is labelled '4'. (Nodes 3, 5, 6 are already labelled, so leave them alone.)

Do you see a pattern?
The left side of the tree has an IPL of 1+2+2+3+4 = 12.

Now try the same approach with the right side of the tree.
 
  • #10
Hi my friend,
Great! I like it.
<
Node 8 is the Root.
Node 3 is next. Node 3's distance from Root is 1, so node 3 is labelled '1'
>
You are trying to provide solution to what andrewkirk stated. Good.

I would try what you say but i think i did not make my question clear. You people are talking about distance. Here in case of IPL distance is not in terms of metres or km but i think its in the context of levels and not in terms of nodes, is this correct??

Zulfi.
 
  • #11
Yes. (Mostly)

Or put another way, you could consider each edge to be one unit of distance.
 
  • #12
Hi,
Thanks for your help. The right side of the tree has IPL = 1 + 2 + 2 + 3 + 3+ 3 + 4= 18.
If i sum (IPL of boh sides) them i would get an answer of 30. Can we say that the lowest IPL of tree is 0 & maximum IPL is 30??
Zulfi.
 
  • #13
You could describe the IPL as the total distance (number of edges) traversed if you visited each node in turn, always starting at the root.

For instance if you start in Paris (the root) and travel to Bonn, that's length 1. Then you return to Paris (free, there was a sale on roundtrip tickets). Then the following month you travel to Tokyo from Paris, but you have to change airlines in Bonn. That makes the Tokyo trip length 2. So altogether your travel length was 3; which is the IDL for your vacation. :smile:

The only way to have a zero IDL is if the only node in a tree is the root. You can't have a length if there is no place to go. And if there is a place to go, there is a length.
 
  • #14
Hi,
Thanks for your help.
<You could describe the IPL as the total distance (number of edges) traversed if you visited each node in turn, always starting at the root.>
I feel your above answer is correct.

Zulfi.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
15
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K