bugGNU Octave - Bugs: bug #66520, treeplot and treelayout vertex...

 
 

bug #66520: treeplot and treelayout vertex coordinates

Submitter:  Liang Tang <lt1234>
Submitted:  Tue 03 Dec 2024 07:23:14 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  In Progress Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Open
Release:  * 9.2.0 Operating System:  * Any
Fixed Release:  None Planned Release:  10.1.0 (current default)
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 06 Dec 2024 01:37:52 AM UTC, comment #8: 

The following info are included in the zip file:

(1) Few adj matrix examples in this m file and one in the attachment.  Adj matrices may not be PSD. 
(2) Utilities,dfs, bfs, sparse_to_csr, (lightly modified from the original) to generate predecessor for treeplot. 
    see https://github.com/dgleich/gaimc
(3) A modified treeplot that outputs vertex xy.
(4) Attachment K.mat
(5) No existing octave function available to display the network defined by the adj matrix. 
    spy or networkvisualizer are used instead.  Matlab's graph algorithm is the better and typically generates
    best display with minimum edge crossing.

(file #56676)

Liang Tang <lt1234>
Wed 04 Dec 2024 11:16:48 PM UTC, comment #7: 

FYI only.

As I had in my initial report, matlab's graph and treelayout perform best from my limited experiences.  Octave does not support network display and "some additional network graph related things" in graph.

Sometime back, I looked into Octave treeplot alternatives in a limited sense.  I excluded any public domain tools that requires mex or file interface.  The best one that I could find is:

https://github.com/serhan-yilmaz/networkvisualizer 

Thanks. 


Liang Tang <lt1234>
Wed 04 Dec 2024 10:40:44 PM UTC, comment #6: 

I cleaned up the code for treeplot (https://hg.savannah.gnu.org/hgweb/octave/rev/dcc639b91ba9).  But, this is really only a start on the issue.

treelayout.m seems to be broken.  I'm going to discuss with Maintainers whether we can just replace it with the code from treeplot.m.

Rik <rik5>
Group administrator
Wed 04 Dec 2024 08:46:11 AM UTC, comment #5: 

I will lookup my old files for some smaller trees.  I don't have large trees. 

Ideally graph is the best plotting solution if adj matrix is the starting point.  But graph implementation looks to be a very demanding task.

Liang Tang <lt1234>
Wed 04 Dec 2024 07:46:32 AM UTC, comment #4: 

[x,y] = treelayout (p)
x =

    0.2000    0.3000    0.4000    0.5000    0.6000    0.7000    0.8000


y =

    0.2500    0.5000    0.2500    0.7500    0.2500    0.5000    0.2500

Liang Tang <lt1234>
Wed 04 Dec 2024 02:56:00 AM UTC, comment #3: 


>> p = [2 4 2 0 6 4 6]';treeplot (p)

Error using vertcat
Dimensions of arrays being concatenated are not consistent.

Error in treeplot (line 21)
X = [x(f); x(pp); NaN(size(f))];
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

>> p = [2 4 2 0 6 4 6] ;treeplot (p)


The 2nd command did plot.

Liang Tang <lt1234>
Wed 04 Dec 2024 01:57:35 AM UTC, comment #2: 

Also, can you try this to see if Matlab requires the input to be a row vector?


p = [2 4 2 0 6 4 6]';
treeplot (p)


Rik <rik5>
Group administrator
Wed 04 Dec 2024 01:53:30 AM UTC, comment #1: 

Could you try the following in Matlab?


p = [2 4 2 0 6 4 6];
[x,y] = treelayout (p)


This throws an error in Octave, which means the treelayout() algorithm is probably rubbish and should just be replaced with the one from treeplot.

Do you have any large treeplot inputs that could be used for benchmarking performance of the algorithm?

Rik <rik5>
Group administrator
Tue 03 Dec 2024 07:23:14 AM UTC, original submission:  

In Octave, treeplot does not exercise treelayout for the vertex  x/y coordinates.  There is no direct access to the vertex x/y for labeling etc. after the treeplot call.

In matlab, treeplot calls treelayout.  To access vertex coordinates, a duplicated treelayout call will do. 

From my limited experiences, for display, Octave treeplot xy coordinates are better than Octave treelayout.  Matlab's xy from treelayout is better than Octave's xy from treelayout and treeplot. 

This report is to request your consideration for
(a) a consolidation of treeplot and treelayout vertex x/y computation. 
(b) The consolidated xy similar to matlab treelayout. Thanks. 


Liang Tang <lt1234>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56676:  treeplot_examples.zip added by lt1234 (12KiB - application/x-zip-compressed)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by lt1234 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-12-06 lt1234 Attached File- Added treeplot_examples.zip, #56676
    2024-12-04 rik5 StatusNeed Info In Progress
    2024-12-04 rik5 StatusNone Need Info
        Operating SystemMicrosoft Windows Any
        Planned ReleaseNone 10.1.0 (current default)

    Back to the top

    Powered by Savane 3.14-04e1.
    Corresponding source code