Previous topic

nodeUpdateRule

This Page

AttributeStateProcess

class nepidemix.process.AttributeStateProcess(nodeAttributeDict, edgeAttributeDict, meanFieldStates, runNodeUpdate=True, runEdgeUpdate=True, runNetworkUpdate=True, constantTopology=False)

This class is a specialization of Process where node and edge states are determined from associated attribute dictionary. As a returned state must be hashable it is defined as the frozen set of the attribute dictionary. Methods that take state names as parameters do this as strings formatted as python dictionaries (thus describing the attribute dictionary).

When initialized this class require a declaration of all possible attribute names, and all possible values those attributes may be set to.

Used for convenience to collect a number of similar methods for all subclasses.

A deriving class need only to overload the __init__ and/or any of the *UpdateRule methods that will be used.

See also

Process
Superclass

Methods

deduceEdgeState(edge) Gives the state of a edge.
deduceNodeState(node) Gives the state of a node.
edgeUpdateRule(edge, srcNetwork, dt) Perform local edge change.
initializeNetwork(network, *args, **kwargs) Initialize the mean field states on the network.
initializeNetworkEdges(network, *args, **kwargs) Set initial edge states and parameters to a network.
initializeNetworkNodes(network, *args, **kwargs) Set initial node states and parameters to a network.
networkUpdateRule(network, dt) Perform update to global network structure and attributes.
nodeUpdateRule(node, srcNetwork, dt) Perform local node changes.
__init__(nodeAttributeDict, edgeAttributeDict, meanFieldStates, runNodeUpdate=True, runEdgeUpdate=True, runNetworkUpdate=True, constantTopology=False)

Initialize an object of this class by giving all possible node and edge state values.

If you subclass and overload this method make sure to use super to call it.

Parameters :

nodeAttributeDict : dict

A dictionary where key:val pair is the name of the node attribute and a tuple of all its possible values. Example: {‘age’: (1,2,3,4), ‘colour’: (‘red’,’green’)} denotes a process where nodes have two attributes (age, and colour). The first one can take one out of four different values and the second one of two values. This result in a network with 4*2=8 different node states.

edgeAttributeDict : dict

A dictionary where key:val pair is the name of the edge attribute and a tuple of all its possible values. Example: {‘age’: (1,2,3,4), ‘colour’: (‘red’,’green’)} denotes a process where edges have two attributes (age, and colour). The first one can take one out of four different values and the second one of two values. This result in a network with 4*2=8 different edge states.

meanFieldStates : list

A list of mean field states. The states specified in here will be tracked by the process and stored as a network attribute. Each state is a dictionary made up of either node or edge attribute:value pairs.

runEdgeUpdate : bool

See Process

runNodeUpdate : bool

See Process

runNetworkUpdate : bool

See Process

constantTopology : bool

See Process

Methods

__init__(nodeAttributeDict, ...[, ...]) Initialize an object of this class by giving all possible node and edge state values.
deduceEdgeState(edge) Gives the state of a edge.
deduceNodeState(node) Gives the state of a node.
edgeUpdateRule(edge, srcNetwork, dt) Perform local edge change.
initializeNetwork(network, *args, **kwargs) Initialize the mean field states on the network.
initializeNetworkEdges(network, *args, **kwargs) Set initial edge states and parameters to a network.
initializeNetworkNodes(network, *args, **kwargs) Set initial node states and parameters to a network.
networkUpdateRule(network, dt) Perform update to global network structure and attributes.
nodeUpdateRule(node, srcNetwork, dt) Perform local node changes.

Attributes

CFG_PARAM_deal_exact str(object) -> string