Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

ChemliYoussef's blog

By ChemliYoussef, history, 10 years ago, In English

hello everyone , I want to know if a tree has a single centroid because I encounter some cases where I find 2 centroids...
thanks in advance ...

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
10 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Obviously no, check this one : 1-2-3-4

  • »
    »
    10 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    The reason of my question was being confused by jordan 1869 theorem : " there exists a vertex whose removal partitions the tree into components, each with at most N/2 nodes. " I didn't know if it is talking about only one vertex or more ... thanks a lot ...

    • »
      »
      »
      10 years ago, hide # ^ |
       
      Vote: I like it +4 Vote: I do not like it

      "There exists" means that there is at least one, but there could me multiple ones.

      Actually, there can be at most 2 centroids in a tree and this happens when there's an edge whose deletion splits the tree in half.

»
10 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

a tree either has a single centroid or two neighbouring centroids.

»
10 years ago, hide # |
← Rev. 3  
Vote: I like it +1 Vote: I do not like it

If your question is that is there any tree with one centriod:

yes a star( V=1..n , E=(1,n),(2,n)...(n-1,n) ).

else

tree has at most 2 centroids that if they are 2 they are connected!