Блог пользователя danger1200

Автор danger1200, 7 лет назад, перевод, По-русски

Today I noticed some interesting facts about dfs and bfs algorithms.

Let's consider a complete graph consisting of N vertices. Do bfs and dfs algorithms over this graph. You may be surprised but the spanning tree formed by BFS algorithm looks like a sun so I called this tree "Solnyshko-tree" while the tree formed by DFS algorithms looks like a line so I called it "Bamboooo-tree".

For a better understanding I suggest you to have a look at provided pictures.

Hope you find this topic interesting and useful. Thanks for attention and good luck on the upcoming contest!

  • Проголосовать: нравится
  • -69
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Спасибо, кэп!

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

Почему я так ору

»
7 лет назад, # |
  Проголосовать: нравится -25 Проголосовать: не нравится

"Solnyshko-tree" is called star graph. http://mathworld.wolfram.com/StarGraph.html

Some japanese call star graph "Uni"(ウニ). Uni is a Japanese word for sea urchins. (cf: http://agc009.contest.atcoder.jp/tasks/agc009_d#)

»
7 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

This is the answer to our everyday questions.

»
7 лет назад, # |
  Проголосовать: нравится +42 Проголосовать: не нравится

Are you joking ? :/

»
7 лет назад, # |
  Проголосовать: нравится +47 Проголосовать: не нравится

WOW. I never noticed that. Thanks for sharing your wisdom!!!!!

»
7 лет назад, # |
  Проголосовать: нравится +83 Проголосовать: не нравится

Is this fact correct about the graphs with more than 7 vertices too?

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Of course yes, it is correct for every integer N > 0. You can prove it by induction

    • »
      »
      »
      7 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Man, for N=1 it looks like a put out sun, I'm not buying this.

      • »
        »
        »
        »
        7 лет назад, # ^ |
        Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

        This is neither about sun nor line, it is about the structure of the spanning tree formed by bfs or dfs in a complete graph. N=1 is a special case

        • »
          »
          »
          »
          »
          7 лет назад, # ^ |
          Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

          Ok but for N=2 the so-called sun looks like a bamboo. What u gonna say now? Is every single N a special case of its own? Why am I even trusting you?!?!?!

          • »
            »
            »
            »
            »
            »
            7 лет назад, # ^ |
            Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

            Hmm, I don't see anything wrong here. For example, in my country bamboo is associated with the Sun. No Sun — no bamboo

            • »
              »
              »
              »
              »
              »
              »
              7 лет назад, # ^ |
                Проголосовать: нравится 0 Проголосовать: не нравится

              I don't care about the zodiac, we are talking about competitive programming here.

              • »
                »
                »
                »
                »
                »
                »
                »
                7 лет назад, # ^ |
                Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

                I don't mention any astrology here. As I said before, my topic is not about suns, lines, bamboos etc. I've just wanted to share with codeforces community my observations about the structure of these trees (not about pictures), but these comments are killing me

»
7 лет назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

Nice drawing!

Clear explanations!

Very exciting topic!

Well done.

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

Cmon guys, what's wrong with this post? Sorry if it is a well-known fact but I didn't see it yet. Can you provide a link with this fact if it exists or explain your downvotes otherwise?

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

if this blog wasn't a new idea, but it was a new perspective! so it was appreciable! thanks for writing this blog! keep up writing your new thoughts on cf :)

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wrong observation. That is a new moon, not line.

»
4 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

how is bambooa a tree its a grass