This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes visualizing hierarchy structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "visualizing hierarchy structure" Watch "visualizing hierarchy structure" New topic
Author

visualizing hierarchy structure

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
I have a list of pair of strings (Parent - Child pair). A child can also be a parent of another child.

A,B
A,C
A,D
B,C
D,E
E,C
E,F
E,G
G,H

How do I visualize it? One way is to run a java program to output a delimited file and load it in ms excel, showing below:

A|B|C
_|C
_|D|E|F
_|_|_|C
_|_|_|G|H

Or xml. But I prefer the spreadsheet above.

Anyone know any software that allows visualizing hierarchy structure of pairs of values? Or any code that does it?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Back in my Pascal days I made a very small program that read any list like the one you showed and populated a tree control. Then you could browse the tree just like Windows explorer. I used it to show organization charts, COBOL program structure, data relationships and all kinds of things. JTree would do the job nicely. Have you worked with Swing at all?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
I havent done js2e for a long time already. So I am thinking of just dumping to system.out and cutting into notepad, and opening it in excel.

like (output in system.out):

A;B;C
_;C
_;D;E;F
_;_;_;C
_;_;_;G;H

becomes below, when loaded to excel, using ';' as delimiter:

A|B|C
_|C
_|D|E|F
_|_|_|C
_|_|_|G|H


Technically, actually, these strings are indeed COBOL programs and VSAM files, calling other COBOL programs (both cics, via LINK or START; the VSAMs would be leaves in our tree). Basically, the requirement is: to visualize, all programs, calling what programs, and accessing what vsam files.

Actually, xml is pretty, but I preferred excel, as I may need to further process this tree.

I already figured a few hours ago how to do it:

1. Input:
1.1 2d array of these pairs of strings
1.2 list of programs i want to tree out

2. do:

2.1 produce 2d array of strings like below, using recursion, and indexes to the 2d array mentioned:

A;B;C
_;C
_;D;E;F
_;_;_;C
_;_;_;G;H

2.2 print the array, with delimiter to system.out

Not so detailed pseudocode, but if anyone needs the code, I can share after I complete it.

(Pascal...I dont think they teach that in new curriculums any more, do they?; It shows a little bit how old we are.)
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
I will revise my #2, to use xml, instead of intermediate 2d array.

WSAD or other xml editors can make the text pretty. Then I can open it in excel, etc. and do lots of other possibilities.

Wahhh, xml actually saved me thinking, cpu memory and runtime cost. And its pretty too.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Oh, if you have a reasonable number of entries you could put your list into GraphViz / DOT pretty quickly, too. I use it for a dependency graph of about 20 packages. You might find organization chart or mind mapping software that can do something cool with pure hierarchies, too.

I'm pretty sure I have some recent REXX that did this kind of thing. When I get to my other PC I'll dig around for it. I found something from the 80s but it didn't really attempt a tree layout.
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
I have at least 100 pairs. Can be up to around 300.

I just realized, that due to the nature of the data (COBOL PROG-COBOL PROG, and, COBOL PROG-VSAM), a reversed inheritance diagram would be perfect fit.
[ January 07, 2007: Message edited by: Jesus Angeles ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: visualizing hierarchy structure
 
Similar Threads
Displaying hierarchy diagram
New Mock Exam questions...
HashMap Iteration
Logic with java code
conditional operater?