Lably
Skip to content

Dependency graph

Directed graph representing dependencies

  • 4 min read
  • 5 chapters

Related on Lably

Through Mathematics, Computer science and Directed graph

Definition

Given a set of objects S and a transitive relation R⊆S×S with (a,b)∈R modeling a dependency "a depends on b" ("a needs b evaluated first"), the dependency graph is a graph G=(S,T) with T⊆R the transitive reduction of R.

For example, assume a simple calculator. This calculator supports assignment of constant values to variables and assigning the sum of exactly two variables to a third variable. Given several equations like "A = B+C; B = 5+D; C=4; D=2;", then S={A,B,C,D} and R={(A,B),(A,C),(B,V),(A,V)}. You can derive this relation directly: A depends on B and C, because you can add two variables if and only if you know the values of both variables. Thus, B must be calculated before A can be calculated. Since B depends on D to be calculated, A must also depend on D to be calculated before it (hence the transitive property stated above). On the other hand, the values of C and D are known immediately, because they are number literals.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Topics in mathematics