Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

12
Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011

Transcript of Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Page 1: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Tree isomorphism

by Antonina Kogut

FCS-2, group 3, October 2011

Page 2: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Attribute

Coherent graph without any cycles is called the treetree.

IsomorphismIsomorphism – logical and mathematical concept, that expresses similarity of system’s structure.

Two trees are isomorphicisomorphic if it is possible to reflect one tree into another with precision of renaming his sons.

Page 3: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Observation

Two trees are isomorphicisomorphic only in case they have the same number of levels and tops on these levels.

Page 4: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Example

Here we can see that these trees have the same structure but different construction.

Confrontation of tops are: 1-1, 2-3, 3-2, 4-4

Page 5: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Confrontation

For every top we have some numbers {x,y,{a1,…,an}},whereх – level of a top for a height;у – “parent’s” level;a – line of father’s levels of sons.

For the first tree we have1 - {2, 2, {0, 1}}, 2 - {1, 0, {0}}, 3 - {1, 1, {0}}, 4 - {0, 0, {0}}

For second we have 1 - {2, 2, {1, 0}}, 2 - {1, 1, {0}}, 3 - {1, 0, {0}}, 4 - {0, 0, {0}}.

Page 6: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

We have 2 groups of records now. So we can say that if we can set up a reflection between 2 trees thеn they’re isomorphic.

We should take into the consideration:1. While comparing groups we mustn’t take care

of ordinal number of an element;2. Do not care about order of elements in line of

father’s levels of sons.

Page 7: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

How to define whether two trees are isomorphic

1: procedure isomorphic (T1,T2)• 2: define number of nodes in trees;• 3: assign 0 for all leaves of a tree;• 4:let L1 –quantity of leaves of the first tree on 0-level; • 5:let L2 – quantity of leaves of the second tree on 0-level;• 6:for all level beginning with the first• 7:• construct the sequence of cabins• 8: If trees have the same number of elements(and they can be

replaced) then• 9: T1 і T2 are isomorphic• 10: else• 11: T1 і T2 aren’t isomorphic• 12: end

Time assessment О(n)

Page 8: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

This picture illustrates the process of investigation of tree isomorphism.

Page 9: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

The result

So we have defined that two trees are isomorphic. Now we get this tree and we are able to work with this one not with the previuos both trees.

Page 10: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

The usage

Tree isomorphism is the basis of natural explanation of more general problems of subtrees and the huge amount of similar trees.

Page 11: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Something more… Sometimes trees are used to draw the

genealogical tree of a person.

Here we can see the Biblian geneological tree.

Page 12: Tree isomorphism by Antonina Kogut FCS-2, group 3, October 2011.

Список літератури

1. http://distedu.ukma.kiev.ua/mod/resource/view.php?id=639 (із матеріалів Глибовця М.М.);

2. http://www.lsi.upc.edu/~valiente/graph-00-01-c.pdf

3. http://www.informatics.ru/?page=lib_viewarticle&article_id=29