Can a Node Have Multiple Parents in Trees?

In summary: So what does an unrooted tree exactly mean ?An unrooted tree is a tree where the root node is not the only node in the tree.
  • #1
mohamed el teir
88
1
i know that a node cannot have more than one parent given that these parents have common ancestor (because this is undirected cycle and a tree must have no cycles).
but can a node have more than one parent given that these parents don't have common ancestor (which will produce an unrooted tree i think) ??
 
Technology news on Phys.org
  • #2
What circumstances would you use such a data structure? Sounds like a relational database.
 
  • #3
newjerseyrunner said:
What circumstances would you use such a data structure? Sounds like a relational database.
i am not planning now to use this but as a concept i want to know is this right or wrong
 
  • #4
mohamed el teir said:
[...]
but can a node have more than one parent given that these parents don't have common ancestor (which will produce an unrooted tree i think) ??

That would imply multiple roots and is not allowed (see definition section):
https://en.wikipedia.org/w/index.php?title=Tree_(data_structure)&oldid=712433755#Definition

In a tree a node has at most a single parent, which is also mentioned in the article linked above.

You can have multiple (read a collection of) trees though, but those aren't interconnected then and don't count as a (single) tree (see 5th graphic in definition section).
 
Last edited:
  • #5
Dominik Tugend said:
That would imply multiple roots and is not allowed (see definition section):
https://en.wikipedia.org/w/index.php?title=Tree_(data_structure)&oldid=712433755#Definition

In a tree a node has at most a single parent, which is also mentioned in the article linked above.

You can have multiple (read a collection of) trees though, but those aren't interconnected then and don't count as a (single) tree (see 5th graphic in definition section).
so what does an unrooted tree exactly mean ?
 
  • #7
In graph terminology, any graph without cycles is a tree. As a data structure, the navigability between nodes, like parent and child relations, usually express some kind of hierarchy between nodes which comes "on top" of the tree graph in order to serve some purpose, like for instance expressing a search tree. In principle you could have tree data structures with many or no roots depending on what the relationship means.
 
  • #8
Usually the point of a tree is to know where you came from, which implies a single parent. If you're just wanting to conserve space, you could wrap all of your nodes in a reference counter.
 
  • #9
Supposing your current concern is about computational molecular biology, particularly algorithmic approaches available to building phylogenetic trees.
mohamed el teir said:
i know that a node cannot have more than one parent given that these parents have common ancestor (because this is undirected cycle and a tree must have no cycles).
Yes, that is partly true about the inadequacy of using phylogenetic trees alone to represent the histories of species in question. As a matter of fact, two daughter branches may have only one parent in a binary tree.
but can a node have more than one parent given that these parents don't have common ancestor (which will produce an unrooted tree i think) ??
There are actually several types of trees used to model species relationships in phylogenetic study. The most commonly mentioned ones are rooted and unrooted trees, either of which can't be used to fully model outcomes of such events of the so-called reticulate evolution as gene transfer, hybridization, recombination, reassortment etc. These are what your concern is exactly about that whether or not a child can have two parents at the same time. We therefore have to opt to choose a better modeling tool called a phylogenetic network instead, which is also a graph being again as either rooted (e.g split, median, quasi-median, etc.) or unrooted (e.g haplotype, reticulograms) one. You can google on these terms to learn more about their applications in practice.
 
  • #10
I seem to recall that C++ allows multiple inheritance, which may be an example of what you are referring to. For example, a given object O can inherit properties from two different ancestors. It can also be the parent of multiple descendants. For a designer point of view, this turned out to be a prescription for disaster, which is why most OO languages do NOT support multiple inheritance. So we're not talking trees, per se, but once you start doing that, you no longer have a tree, as was pointed out above. You just have a graph. And you can try to avoid cycles in it, but it's not what is called a "tree" any longer in strict comp. sci. terminology.
 

What is a data structure?

A data structure is a way of organizing and storing data in a computer so that it can be accessed and modified efficiently. It provides a framework for organizing and managing data in a way that reflects the relationships between different pieces of information.

What is a tree data structure?

A tree data structure is a hierarchical data structure that consists of nodes connected by edges. It is similar to a real-life tree, with the root at the top and branches extending downwards. Each node can have multiple child nodes, but only one parent node.

What are the advantages of using a tree data structure?

Tree data structures are efficient for storing and retrieving data. They allow for quick insertion and deletion of nodes. Trees are also useful for representing relationships between different data points, making them useful for tasks such as organizing data, sorting, and searching.

What are some common types of trees?

Some common types of trees include binary trees, binary search trees, AVL trees, B-trees, and red-black trees. Each type has its own unique structure and properties, making them useful for different types of data and tasks.

How do trees differ from other data structures?

Trees differ from other data structures, such as arrays and linked lists, in that they have a hierarchical structure. This means that each node has a specific relationship with other nodes, making it easier to represent complex relationships between data points. Trees are also efficient for searching and organizing data compared to other data structures.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
847
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
2
Replies
40
Views
6K
  • Programming and Computer Science
4
Replies
107
Views
5K
  • Programming and Computer Science
Replies
13
Views
4K
  • Programming and Computer Science
Replies
20
Views
4K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
  • Programming and Computer Science
Replies
15
Views
2K
Back
Top