This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Create and Graph an odd tree structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Create and Graph an odd tree structure" Watch "Create and Graph an odd tree structure" New topic
Author

Create and Graph an odd tree structure

Ralph Lepine
Greenhorn

Joined: Dec 26, 2011
Posts: 2
Dear Experts,

Please forgive the seemingly dumb questions.
I don't work with trees or this kind of low level programming much.

I'm working on a tech problem, and I want to present the answer in a visual graph


------

It has some interesting requirements/characteristics.

a)
One node can have many children. Say 20. Maybe more.
ie. one library can be used by many objects.

b)
A child node can have many parents. Say 20. Maybe more.
ie. many libraries are used by one procedure

c)
A particular node can appear in more than one place.
ie. a generic print, or logging function is called in many procedures


Note:
This is just an -example- in tech terms I expect you will understand.
It is NOT the issue I need to model. No need to discuss it.


------

As I thought about this, it's clearly not a binary tree.


1)
What kind of data structure could I save all the data in?


2)
How could I graph this in java?


3)
What is a free open source graphing software that could graph such a tree?
Such as Neo4j

Perhaps in formats:
- as a tree, with a root, trunk, branches, and leaves?
- Like the graphs you see now, depicting social networks, with the root node in the center?


4)
Any good websites, or tutorials on this subject?



Thanks a lot!

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Well, it isn't a tree, because it doesn't have a root node. So all of those ideas which were tree-based aren't right. As far as I can see it's just a graph -- any node can be connected to any other node.

As for storing the data, you wouldn't usually store data in anything resembling the structure you would use to display it. For example you wouldn't store data which you displayed as a tree in some kind of tree thing, you'd just store the nodes and their relationships in probably a database table or two. Likewise for this: store the nodes and their relationships.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create and Graph an odd tree structure
 
Similar Threads
Binary Search Tree Freezes
Which collection to use?
recursion backwards?
Object Graphs.
Builder Pattern Question