A directed tree can be rerooted at any of its nodes.  For example, t1 from 
http://www.jsoftware.com/jwiki/Essays/Tree_Display , 


   |:t1
0 0 1 2 2 3 3 4 4  4  4  5  5  6  6  6  6  7  7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
   tree t1
+----------------------------+
|                       ┌─ 14|
|                       ├─ 15|
|                 ┌─ 6 ─┼─ 16|
|                 │     └─ 17|
|     ┌─ 1 ─── 3 ─┤     ┌─ 18|
|     │           └─ 7 ─┴─ 19|
|     │           ┌─ 8       |
|─ 0 ─┤           ├─ 9       |
|     │     ┌─ 4 ─┼─ 10      |
|     │     │     └─ 11      |
|     └─ 2 ─┤     ┌─ 12      |
|           └─ 5 ─┴─ 13      |
+----------------------------+

Can be rerooted at 3 as,

   tree t2=. 3 reroot t1 
+----------------------------------+
|           ┌─ 14                  |
|           ├─ 15                  |
|     ┌─ 6 ─┼─ 16                  |
|     │     └─ 17                  |
|     │     ┌─ 18                  |
|     ├─ 7 ─┴─ 19                  |
|─ 3 ─┤                       ┌─ 8 |
|     │                       ├─ 9 |
|     │                 ┌─ 4 ─┼─ 10|
|     │                 │     └─ 11|
|     └─ 1 ─── 0 ─── 2 ─┤     ┌─ 12|
|                       └─ 5 ─┴─ 13|
+----------------------------------+
   
   |:t2 NB. (reroot rendering t2 or equivalent)
3 3  6  6  6  6  7  7 3 1 0 2 2 4 4  4  4  5  5
6 7 14 15 16 17 18 19 1 0 2 4 5 8 9 10 11 12 13


Has any J version of reroot been made public already?


----- Original Message ----
From: Roger Hui <[EMAIL PROTECTED]>

Nothing new under the sun.
http://groups.google.com/group/comp.lang.apl/browse_thread/thread/5f1c1df7bd72fe51/32691205433c3152?lnk=gst#32691205433c3152

----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>

> http://www.jsoftware.com/jwiki/Essays/Tree_Display
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to