G
Guest
I need to figure out how to write a loop that will do the
following things. I need to arrange a spreadsheet that
contains information on lines into an ordered fashion.
The first column says the line number. The next three
columns tell the children of the line. For example if
101, 102, and 103 are connected to 100, 100 would be
listed with three children (101, 102, and 103). Here is
what the file looks like if 101, 102, and 103 also had
children.
This file would denote line 100 as the starting line.
100 branches into three other lines (101, 102, and 103).
101 branches into 104. 104 has no children. 102 then
branches itno 105 and 106. Etc...
The before file would look like this:
Line Child Child Child
100 101 102 103
107
105
102 105 106
103 107
104
106
101 104
The after file would like this:
Line Child Child Child
100 101 102 103
101 104
104
102 105 106
105
106
103 107
107
I need to write a loop that will pick the first child and
list it next.
Then it will list that child's children next. If it
doesn't have any children, it will go back to the last
child that hasn't been listed and go from there. Like I
said, the file that I listed is organized in the fashion
that I need. I don't know what types of loops to write
or how to get started.
I already wrote the program to move the
first line to the top. It does that from other data that
I haven't listed. That is why line 100 is at the top in
both. These aren't the exact files. The real file is
much bigger, but if I can get a program to work for this
little line, it will work for the big one. Thank you so
very much.
following things. I need to arrange a spreadsheet that
contains information on lines into an ordered fashion.
The first column says the line number. The next three
columns tell the children of the line. For example if
101, 102, and 103 are connected to 100, 100 would be
listed with three children (101, 102, and 103). Here is
what the file looks like if 101, 102, and 103 also had
children.
This file would denote line 100 as the starting line.
100 branches into three other lines (101, 102, and 103).
101 branches into 104. 104 has no children. 102 then
branches itno 105 and 106. Etc...
The before file would look like this:
Line Child Child Child
100 101 102 103
107
105
102 105 106
103 107
104
106
101 104
The after file would like this:
Line Child Child Child
100 101 102 103
101 104
104
102 105 106
105
106
103 107
107
I need to write a loop that will pick the first child and
list it next.
Then it will list that child's children next. If it
doesn't have any children, it will go back to the last
child that hasn't been listed and go from there. Like I
said, the file that I listed is organized in the fashion
that I need. I don't know what types of loops to write
or how to get started.
I already wrote the program to move the
first line to the top. It does that from other data that
I haven't listed. That is why line 100 is at the top in
both. These aren't the exact files. The real file is
much bigger, but if I can get a program to work for this
little line, it will work for the big one. Thank you so
very much.