Variable Dependency Graph¶
The Variable Dependency Graph widget builds a directed network whose nodes are variables and whose edges encode the dependencies declared in their expressions. Edge weights reflect the time-window size used by the expression, making it easy to spot which derived features have the widest temporal footprint.
The Variable Dependency Graph widget.¶
Inputs¶
Signal |
Type |
Description |
|---|---|---|
Variable Definitions |
|
A configuration table containing the |
Outputs¶
Signal |
Type |
Description |
|---|---|---|
Network |
|
A directed weighted graph. |
How It Works¶
The widget processes the input table row by row:
A row whose
Expressioncell is empty /NaN/?is treated as an original variable (source feature,var_type = Original).A row with a valid expression is treated as a derived variable (
var_type = Derived).
For every derived variable, the widget scans its expression for
references to known variable names. Every reference produces one
directed edge source → dependency (i.e. an edge X1 → X2 means
“X1’s expression references X2”).
Edge Weights¶
Each edge carries a numeric weight that summarises how far back or forward in time the source variable looks at its dependency.
Rule¶
For an edge Xᵢ → Xⱼ:
If
Xⱼappears inside one or more temporal calls inXᵢ’s expression (shift,sum,mean,count,min,max,sd), the weight is the maximum absolute integer argument across all such calls.If
Xⱼonly appears outside temporal calls (e.g.Xⱼ + 1), the weight defaults to1.
Examples¶
Expression on the source |
Edge weight |
Notes |
|---|---|---|
|
|
One temporal call, single argument. |
|
|
|
|
|
Plain reference, no temporal window. |
|
|
Mixed usage; the temporal occurrence wins. |
|
|
Maximum across all temporal calls. |
|
|
Per-dependency: edges |
Node Metadata¶
The output network exposes per-node metadata in network.nodes for
downstream styling:
Meta |
Type |
Values |
|---|---|---|
|
String |
Sanitised variable name (spaces and hyphens become |
|
Discrete |
|
|
String |
The literal expression text for derived variables; empty for original ones. Pick it as Label in Network Explorer to see each derived node’s formula directly on the graph. |
Controls¶
Generate — rebuilds the graph from the current configuration table. The widget also auto-regenerates whenever a valid input arrives.
Warnings¶
Input has no derived variables; the dependency graph is empty. Fires when every row of the configuration table is an original variable (no
Expressionset). The output network has nodes but no edges. Usually means you forgot to attach the second output of Time Features Constructor instead of the data output.
Input Requirements¶
The first two columns of the input table must be named exactly
Variable and Expression. Any other shape is rejected with an
explicit error message; no network output is sent.
Usage Example¶
Connect the Variable Definitions output of Time Features Constructor to the input of this widget.
Connect the Network output to the Network Explorer widget from the Orange Network add-on.
In Network Explorer:
Color the nodes by
var_typeto separate derived from original features.Optionally map the edge thickness to the edge weights (the
dataarray of the sparse adjacency matrix) to visualise which dependencies span the widest temporal windows.
Implementation notes¶
Variable name lookup is O(1) via a precomputed
name → indexmap, so the full graph build is linear in the number of references.The detection regex uses word boundaries (
\b), soX1will not match insideX10.Sanitisation maps spaces and hyphens to underscores so the names line up with how the Time Features Constructor rewrites them inside expressions.