0

I'm working on small tool to manage dependencies between applications. For example app_one depends on app_two and app_three. Simplest way to store those relations is dict

dep = {
'app_one': 'app_two',
'app_two': '',
'app_three': 'app_one, app_four',
'app_four': 'app_two, app_three'
} 

Now I'm wonder how to find such cyclic dependencies like between app_three and app_four.. Or maybe I should use something different than dict.

Iterating through dict and manually fining that relations could be slow and not efficient.

Thanks.

Zobia Kanwal
  • 4,085
  • 4
  • 15
  • 38
darvark
  • 314
  • 3
  • 15
  • 2
    You'll have to build a graph and use [known algorithms](https://stackoverflow.com/questions/261573/best-algorithm-for-detecting-cycles-in-a-directed-graph) to find cycles. – Nir Alfasi Mar 13 '19 at 19:51
  • Thank's looks like it solved my problem. – darvark Mar 13 '19 at 19:59

0 Answers0