0

I have a sequence of variables of type x. Type x is defined as

(a: Int, b: Set[Int])

Some variables have overlapping values for b. For example, variables

p = (1, Set(1, 2, 3)) 
q = (5, Set (3, 4, 5))
r = (10, Set(9, 10))

The notion of dependency is that if variables have overlapping values of b, this indicates that they are dependent (for this example, p and q are dependent, r is independent). I want to make a dependency graph where the variables which are dependent has an edge and the independent variables are single nodes. How can I achieve this in Scala?

Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
D.L.
  • 169
  • 3
  • 17
  • Is it probability theory or is it register allocation, or is it something entirely different? Are you sure that you don't want to call it "interference"? – Andrey Tyukin Mar 05 '18 at 17:39
  • There are many possible answers, from one-sentence "use container X and algorithm Y" to something that contains a comprehensive Scala tutorial and relevant topics from graph theiry and computer science. What kind of answer do you expect? Here's one of the first kind: build a reverse map `Map[Int, Set[Var]]` and connect all variables in each separate set. (Ints come from 'b'). – n. m. could be an AI Mar 05 '18 at 17:52

0 Answers0