Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Create and Graph an odd tree structure  RSS feed

Ralph Lepine
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

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

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

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

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.

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

How could I graph this in java?

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?

Any good websites, or tutorials on this subject?

Thanks a lot!

Paul Clapham
Posts: 22468
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!