创建树结构的问题 [英] Problem to create tree structure

查看:64
本文介绍了创建树结构的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在努力寻找使用列表创建树结构的方法。 


树形结构我看起来像这样:


    Box0

    Box1 
  Box2

      Box3 
Box4       Box5 
Box6


然后,每个Box都具有低于2维的列表,我将保留数据:

 List< List< String>> NODE2lists = new List< List< String>>(); 

因此,如果我们查看结构,我们有3个维度,例如Box3和Box4在第3维。


所以Box1和Box2连接到Box0


  &NBSP;   Box3和Box4连接到Box1


  &NBSP;   Box5和Box6连接到Box2


我们如何为此创建列表结构?



解决方案

您好,


我正在努力寻找创建树的方法结构使用列表。 


我所追求的树形结构如下所示:



 Box0 
Box1 Box2
Box3 Box4 Box5 Box6


然后,每个Box都有2维以下列表,我将保留数据:

列表与LT;列表与LT;字符串>> NODE2lists = new List< List< String>>(); 

因此,如果我们查看结构,我们有3个维度,例如Box3和Box4在第3维。


所以Box1和Box2连接到Box0


  &NBSP;   Box3和Box4连接到Box1


  &NBSP;   Box5和Box6连接到Box2


我们如何为此创建列表结构?




Hello,

I am struggling to find a way to create a tree structure using lists. 

The tree structure I am after looks like this:

   Box0
    Box1    Box2
      Box3  Box4      Box5  Box6

Each Box is then though of having below 2-dimensional list where I will keep data:

List<List<String>> NODE2lists = new List<List<String>>();

So if we look at the structure we have 3 dimensions where for example Box3 and Box4 is in the 3rd dimension.

So Box1 and Box2 is connected to Box0

     Box3 and Box4 is connected to Box1

     Box5 and Box6 is connected to Box2

How could we create a list structure for this?

解决方案

Hello,

I am struggling to find a way to create a tree structure using lists. 

The tree structure I am after looks like this:

                            Box0
           Box1 		 	        Box2
      Box3 	Box4		  Box5 	Box6

Each Box is then though of having below 2-dimensional list where I will keep data:

List<List<String>> NODE2lists = new List<List<String>>();

So if we look at the structure we have 3 dimensions where for example Box3 and Box4 is in the 3rd dimension.

So Box1 and Box2 is connected to Box0

     Box3 and Box4 is connected to Box1

     Box5 and Box6 is connected to Box2

How could we create a list structure for this?


这篇关于创建树结构的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆