views:

195

answers:

8

This is me showing that I didn't get a CS degree. What I'm wondering is what the heck you call this:

  • every node has a id (unique) and a parentId
  • the node at the top of the tree has no parentId
  • a parent node can have 0...n child nodes, or maybe it's more correct to say that a parent node id can appear in 0..n nodes

Seems simple right? But it's not a b-tree as far as I can tell, since it's not balanced. Is it an unbalanced tree? Couldn't find an entry in wikipedia for that so I assume that the term doesn't exist.

Edit: I was really stuck on this thing not being a b-tree, so I thought there would be a term for trees that are not balanced. And there is: tree.

+13  A: 

Isn't it a simple tree?

Grzegorz Oledzki
I think you're right. Dumb question now that I look at it.
jcollum
Yup. some would probably call it a n-ary ordered tree.
nos
Don't think it's an ordered tree. As stated, there is no need to sort siblings. There is no natural order that applies.Call it an n-ary unordered tree.
Alan
+2  A: 

I would simply call it a tree. Though technically there may be a term for a non-binary && non-balanced tree. IMO, tree works fine. I might also refer to it as hierarchical data.

Neil N
+2  A: 

It's just a tree. There's no need for any more distinction than that, IMO.

Jon Skeet
+3  A: 

A really screwed up organization may only be able to represented by a graph. ;-)

tvanfosson
Matrix management, or even just a few "dotted lines" would mean it wasn't a tree without being totally screwed.
Richard
+16  A: 

At the most general it is a graph. Since there is a directed relationship between the nodes (namely from the child nodes to the parent) it is also a directed graph or digraph. Presumably there are no loops in the graph (i.e. A -> B, B -> C, C -> A) so it is an directed acyclical graph (DAG). And since there is also likely to be a single root node it is also a tree.

Bryan Traywick
see that's the computer science type answer I was going for, thanks
jcollum
Then why not accept this answer?
DR
@DR: what's the hurry?
jcollum
+1  A: 

As long as any one node does not reference more than one direct parent, then it can be a tree.

Jason Miesionczek
A: 

As everyone points out, you probably don't need anything more complicated than a tree.

To the more complicated structures like a graph, it's not entirely crazy.

See Martin Fowler's paper on accountability structures. That said, I can say from first hand experience, it's better to avoid modeling an org tree as a graph, when you don't need it.

Alan
A: 

A mathematician would say it is a rooted tree, as in graph theory trees need not have a root.

In computer science almost all trees come with roots, so as the others have pointed out it is called just a tree.

starblue