NodeNetwork: Example
NodeNetworks are an aggregator component that create a network (i.e. mathematical graph) topology in which its members are nodes. They consist of an array of these graph nodes with weighted directed connections. Each node in the array contains a Capsule instance, a node number, and properties (including PRIMOPs).
- Property Example: myId returns the caller's node number.
- PRIMOP Property Example: CONNECTIONS_IN() returns a list of Objects. Each Object in the list contains an id and weight of connection to the current node.
Example: Simplified NetDiffuse
We will be going over a simplified of the NetDiffuse model in the built in NOVA Model Library under 6-Network Models.
- Step 1: Set up a NodeNetwork component.
- Step 2: Set up the sublayer.
Each node is an instance of the sublayer. That means that the sublayer has all of the specifications for the node, including its properties and influences to and from other nodes.
- Step 3: Check the connections to and from the node (sublayer).
CONNECTIONS_IN() is a property of NodeNetworks. It returns a list of Objects. Each Object in the list contains an id and weight. The weight comes from the Connector specified at the top level.
Similar to above, CONNECTIONS_OUT() is a property of NodeNetworks. It returns a list of Objects. Each Object in the list contains an id and weight. The weight comes from the Connector specified at the top level.
- Step 4: Overall structure of toplayer.
We are calling 4 instances of the node sublayer in the NodeNetwork. The nodes are connected based on probabilities specified in the nconnect variable.
We must initialize the NodeNetwork with the node structure. In this case we use the node sublayer as the instances that are called in the NodeNetwork at the toplayer. Furthermore, we assign the connections between the nodes by assigning Connector the nconnect variable.
- Step 5: Look into each node.
Now we can look into each node using Spy plug-ins.
We create the show_nodes_1 CodeChip with the code pictured above. It takes the input from the nodes term.
Finally, we see that the values of temp (specified at the node sublayer) for each node match the relative size within the CNet Viewer.