I have a problem on a dependency algorithm, the dependency is similar to maven dependency, except it's strict version scope based.
For example:
component A, version 1 depends on: component B, version 1~3; and component C, version 2~3
component D, version 1 depends on: component B, version 2~4; and component C, version 1~2
Now, I want to get dependencies when I want to install component A, version 1 and component D, version 1. Because they are all depend on component B,C so I need a correct algorithm to get correct version of B and C
Further more, I may need to upgrade component A and D. For example, now I have below new versions:
component A, version 2 depends on: component B, version 3~5; and component C, version 4~5
component A, version 3 depends on: component B, version 6~7; and component C, version 4~5
component D, version 2 depends on: component B, version 3~4; and component C, version 3~4
Now I need a algorithm to get the correct version of A and D which I can upgrade to and all their dependencies. One problem here is Component A, version 3 and Component D, version 2 has dependency conflict of component B
Is there existing algorithm to resolve such problem? Or similar(easier) problem. Do you have any suggestion?
As there should not be lots of data, so don't consider the performance.
Thanks in advance!