This should get you close.
Given
var companyGroups = new List<CompanyGroup>
{
new CompanyGroup {GroupName = "ELECTRONICS", LeftID = 1 , RightID =20 },
new CompanyGroup {GroupName = "TELEVISIONS", LeftID = 2 , RightID =9 },
new CompanyGroup {GroupName = "TUBE", LeftID = 3 , RightID =4 },
new CompanyGroup {GroupName = "LCD", LeftID = 5 , RightID =6 },
new CompanyGroup {GroupName = "PLASMA ", LeftID = 7 , RightID =8 },
new CompanyGroup {GroupName = "PORTABLE ELECTRONICS", LeftID =10 , RightID =19 },
new CompanyGroup {GroupName = "MP3 PLAYERS ", LeftID =11 , RightID =14 },
new CompanyGroup {GroupName = "FLASH ", LeftID =12 , RightID =13 },
new CompanyGroup {GroupName = "CD PLAYERS ", LeftID =15 , RightID =16 },
new CompanyGroup {GroupName = "2 WAY RADIOS ", LeftID =17 , RightID =18 },
};
then this
var results = from node in companyGroups
from parent in companyGroups
where node.LeftID >= parent.LeftID && node.RightID <= parent.RightID
group node by node.GroupName into g
orderby g.First().LeftID
select new { GroupName = g.Key, Depth = g.Count() - 1 };
yields
{ GroupName = ELECTRONICS, Depth = 0 }
{ GroupName = TELEVISIONS, Depth = 1 }
{ GroupName = TUBE, Depth = 2 }
{ GroupName = LCD, Depth = 2 }
{ GroupName = PLASMA , Depth = 2 }
{ GroupName = PORTABLE ELECTRONICS, Depth = 1 }
{ GroupName = MP3 PLAYERS , Depth = 2 }
{ GroupName = FLASH , Depth = 3 }
{ GroupName = CD PLAYERS , Depth = 2 }
{ GroupName = 2 WAY RADIOS , Depth = 2 }