scitools.com

← Graph catalog

Assignments is one of the interactive graphs Understand can draw of your code — call trees, dependencies, control flow, and more.

Assignments

Languages: Ada, C#, C++, Java
Targets: Functions, Objects
Variants: Classic, Cluster, Compare, Relationship, Simplified

Show the objects, functions, and parameters that a selected entity's value is directly or indirectly assigned from.

For a selected object, variable, or parameter, this shows edges from the entities on the right-hand side of assignments where the selected entity is the target. Passing a value as a function argument counts as an assignment to the corresponding parameter. For a selected function, the graph tracks its return expression the same way, treating return statements as assignments to the function itself.

Edges are solid when the source is assigned directly (e.g. demoObject = x;) and dashed when the source is only part of a larger expression (e.g. demoObject = indirectObject + 1;). Compound assignment operators like += and ++ are tracked the same way — since they combine the existing value with another operand, they always produce a dashed (indirect) edge from that operand, e.g. demoObject += plusEqualsObject;. Literal values are never tracked, so an increment like demoObject++; produces no edge at all; use the Variable Tracker graph if you need those too. The inverse graph, Assigned To, shows the reverse relationship — the assignments a selected entity's value feeds into.

For example, see the following code and corresponding graph

extern int directFunction();
extern int indirectFunction();
extern int indirectObject;
extern int plusEqualsObject;

int demoFunction(int demoParameter)
{
  switch (demoParameter) {
    case 0: return demoParameter; // demoParameter -> demoFunction()
    case 1: return directFunction(); // -> demoFunction()
    case 2: return 0; // literal, no reference
    default:
      // All indirect: part of an expression
      return indirectObject + // indirectObject -> demoFunction()
             indirectFunction() + // -> demoFunction()
             1; // literal, no reference
  }
}

void myFunction(int x)
{
  // demoFunction() -> demoObject; also x -> demoParameter
  int demoObject = demoFunction(x);

  demoObject = x; // x -> demoObject
  demoObject = 0; // literal, no reference

  // All indirect: part of an expression
  demoObject = indirectObject + // indirectObject -> demoObject
               // demoFunction() -> demoObject; x -> demoParameter
               demoFunction(indirectObject + 1) +
               1; //  literal, no reference

  demoObject ++; // modification by literal, no reference

  // modification by plusEqualsObject, indirect assignment
  demoObject += plusEqualsObject;
}

Assignments - Classic

The Classic variant is similar to the Simplified variant, showing all relationships in a simple tree, but it uses a custom layout algorithm instead of Graphviz.


Back to Assignments

Assignments - Cluster

The Cluster variant groups entities by their containing class/file/architecture.


Back to Assignments

Assignments - Compare

The Compare variant shows how the graph has changed relative to the project's comparison database.


Back to Assignments

Assignments - Relationship

The Relationship variant filters the graph to only paths connecting the two entities.


Back to Assignments

Assignments - Simplified

The Simplified variant shows all relationships in a simple tree (no clusters)


Back to Assignments