A Link is a connection between two
Entity, two Variable, or two StaticVariable instances,
the source and the target.
The linked target is then essentially a reference to the source.
So the values of the variables in target will all mimic the
values in the corresponding source variables.
The link can then only connect to entities or variables in its graph
(plus the inputs and outputs of its scope) and to the inputs and outputs
of child-graphs of its graph.
Furthermore sub-entities of allowed entities are also allowed.
an output (sub-)entity or variable of the graph (the scope of the link)
an input (sub-)entity or variable of a child graph of the graph
a free (sub-)entity or variable of the graph
An entity or variable can only be the target to one link.
Any link configuration which could result in a conflict of sources is
forbidden. For example an entity cannot be the target of a link if one of
its (sub-)entities or contained variables is already a target.
If the variable is modified from a entity or variable scope,
the modifications have no effect and the links stays active.
withg:Graph("sg0")withsg0:withoutputs:Entity("e")withe:Variable("v")Variable("w")outputs.e.v.mean=0.outputs.e.w.mean=0.Graph("sg1")withsg1:withinputs:Entity("e")withe:Variable("v")Variable("w")w.mean=11# this is overwritten by the linkinputs.e.v.mean=12# this overwrites the linklink(sg0.outputs.e,sg1.inputs.e)
The link has no effect on g.sg1.inputs.v, because g.sg1.inputs.v
was modified from a graph scope. However, g.sg1.inputs.w
is affected by the link, because it was only modified from within an entity
withg:Graph("sg1")withsg1:withinputs:Entity("e")withe:Variable("v")Variable("w")inputs.e.v.mean=12# is immune to the linklink(sg0.outputs.e,sg1.inputs.e)withg:withsg1:withinputs:withe:w.mean=11# this has no effect since the link trumps it