My problem is the following.

In the tree root is a altitude value and in the nodes are
altitude differences of the adjacent nodes in the graph.
Let the tree sum from root to nodes (from left to right)
to obtain in all nodes altitudes.

My question: how need to modify in the tsum_des verb
(Jwiki/Essays/Tree Sum) for this end?

Thank you in advance.

An example to this.

   v=: 15 [EMAIL PROTECTED] 20
   (i.15) , p ,: v
  0    1   2   3   4   5   6   7   8   9  10  11  12  13 14
  0    0   0   1   2   2   3   3   4   4   4   4   5   5  6
182 _127 _61 _15 _69 _71 _29 _23 _52 _38 _46 _34 _37 _32  0

                                                ┌─ 6  (_29 11) ─── 14 (0 11)
               ┌── 1 (_127  55) ─── 3 (_15 40) ─┴─ 7  (_23 17)
               │                                ┌─ 8  (_52  0)
─ 0 (182 182) ─┤                 ┌─ 4 (_69 52) ─┼─ 9  (_38 14)
               │                 │              ├─ 10 (_46  6)
               └── 2 ( _61 121) ─┤              └─ 11 (_34 18)
                                 │              ┌─ 12 (_37 13)
                                 └─ 5 (_71 50) ─┴─ 13 (_32 18)
   v  tsum_des2  p
182 55 121 40 52 50 11 17 0 14 6 18 13 18 11

Istvan


2008/5/23 Zsbán Ambrus <[EMAIL PROTECTED]>:

> 2008/5/19 Roger Hui <[EMAIL PROTECTED]>:
> > Grab the node you want to be the root, lift the whole graph, and shake
> ...
>
> It's actually easier to do if you grab an adjacent node to the
> previous root in each step.  If you want to do all the rooting and
> shaking in one step, branches of your tree might jam with each other.
>
> See "http://www.perlmonks.com/?node_id=401421"; for an example.
>
> Ambrus
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to