diffnet
, network
and networkDynamic
Coercion between diffnet
, network
and networkDynamic
diffnet_to_network(graph, slices = 1:nslices(graph), ...)diffnet_to_networkDynamic(graph, slices = 1:nslices(graph),
diffnet2net.args = list(), netdyn.args = list())
networkDynamic_to_diffnet(graph, toavar)
network_to_diffnet(graph = NULL, graph.list = NULL, toavar,
t0 = NULL, t1 = NULL)
An object of class diffnet
An integer vector indicating the slices to subset
Further arguments passed to networkDynamic
List of arguments passed to diffnet_to_network
.
List of arguments passed to networkDynamic
Character scalar. Name of the vertex attribute that holds the times of adoption.
A list of network
objects.
Integer scalar. Passed to new_diffnet
.
Integer scalar. Passed to new_diffnet
.
diffnet_to_network
returns a list of length length(slices)
in which
each element is a network
object corresponding a slice of the
graph
(diffnet
object). The attributes list will include toa
(time of
adoption).
An object of class networkDynamic
.
Since diffnet
does not support edges attributes, these will be lost when
converting from network
-type objects. The same applies to network
attributes.
diffnet_to_networkDynamic
calls diffnet_to_network
and
uses the output to call networkDynamic
, passing the resulting list of
network
objects as network.list
(see networkDynamic
).
By default, diffnet_to_networkDynamic
passes net.obs.period
as
net.obs.period = list( observations = list(range(graph$meta$pers)), mode="discrete", time.increment = 1, time.unit = "step" )
By default, networkDynamic_to_diffnet
uses the first slice as reference for
vertex attributes and times of adoption.
By default, network_to_diffnet
uses the first element of graph
(a list) as reference for vertex attributes and times of adoption.
Other Foreign: igraph
,
read_pajek
, read_ucinet_head
# NOT RUN {
# Cohersing a diffnet to a list of networks ---------------------------------
set.seed(1)
ans <- diffnet_to_network(rdiffnet(20, 2))
ans
# and back
network_to_diffnet(graph.list = ans, toavar="toa")
# If it was static, we can use -graph- instead
network_to_diffnet(ans[[1]], toavar="toa")
# A random diffusion network ------------------------------------------------
set.seed(87)
dn <- rdiffnet(50, 4)
ans <- diffnet_to_networkDynamic(dn)
# and back
networkDynamic_to_diffnet(ans, toavar = "toa")
# }
Run the code above in your browser using DataLab