Блог пользователя v-O_O-v

Автор v-O_O-v, история, 5 лет назад, По-английски

I recently started learning graph theory and I completed the traversal algorithms. I am having difficulties in implementing the code which are applications of the traversal. So can anyone share their implementation of basic graph questions like

  1. Check whether an undirected graph is acyclic if not print the cycle.
  2. How to get all paths from a source vertex to a destination in a Directed graph.

Thanks!

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

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

I recommend u to read materials from this link: https://e-maxx.ru/algo/ . It`s on russian, but there is enough on graph theory

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

I suggest you to google some questions before asking them here. The chances are that you will already find many answers, especially if the questions are not very complex and related to fundamentals of some topic. For example, if you google "print a cycle in an undirected graph" or "detect a cycle in an undirected graph" you will find a lot of information and the answer to your first question. You may even find a Codeforces blog asking the same or a very similar question(link) !