Graph task algorithm

I need to check the connectivity of the directed nodes in the list. These are basically questions 2 through 7 each. The answer chosen dictates the following question. Since these pairs will be manually captured, I need to check every possible path to go back (not allowed) and dead ends (all routes should stop at the END node) Any pointers?

start --> n1 --- n2 --- n3 --- n4 --- end

            \  /   \      \   /       /

             n5     \      n6------ n7

              \      \     /       /

               n8----n9---n10----n11

          DIRECTION -->
+3
source share
2 answers

This may be what you are looking for:

Check if the graph is acyclic

Your END node is that the leaf node is in this page terminology.

  • If the graph has no nodes, it is acyclic.
  • If the graph does not have a sheet, it is cyclical.
  • , , 1.

, : , node.

+4

, , . node, , , . , node, node, , , .

+3

Source: https://habr.com/ru/post/1713649/


All Articles