set.dynamic.vertex.attribute {dynamicnetwork} | R Documentation |
Specifies that the named attribute on the vertex in the dynamic network should take on the given value at the givin time and for all later times until the next value
set.dynamic.vertex.attribute(net, attrname, value, valid.time = NULL, v = 1:get.network.attribute(net, "n"))
net |
net dynamicnetwork that the attribute should be set in |
attrname |
attrname String giving the name of the attribute |
value |
value Object to be used as value |
valid.time |
valid.time integer when value should take effect. If null calls set.vertex.attribute from the network package instead with the same parameters |
v |
v indicies of verticies to which the attribute should be added |
This is implemented by adding attributes to 'val' that are [value, time] x num changes matricies. So adding additional values adds more rows to the matrix. (deletion behavior not defined, but should be ok) These attributes are considered 'dynamic attributes', defined by having the vertex name listed in the graph-level attribute 'dynam.attr.names'. Uses the interal set.vertex.attribute method to set the value. The attribute is assumed to have the same value from valid.time until the next specified time for the named attribute on a vertex.
returns the network with the value set
This is very alpha, slow, and should be implemented in the backend using C
This is a very naive implementation that assumes the variables will be added in increasing time order. Violating this should give a warning and then strange results. Easy to do this better in C.
section{Warning }{This is very alpha, slow, and should be implemented in the backend using C}
Skye Bender-deMoll skyebend@skyeome.net, CSDE statnet team
set.vertex.attribute
in the network package,get.slice.network
dyn <- as.dynamic(network.initialize(2)); # a two node network #give vertex one the color blue at time one. dyn <- set.dynamic.vertex.attribute(dyn, "color","blue",valid.time = 0,v=1); dyn <- set.dynamic.vertex.attribute(dyn, "color","red",valid.time = 1,v=1); dyn <- set.dynamic.vertex.attribute(dyn, "color","green",valid.time = 2,v=1);