network | R Documentation |
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
)
graph |
An object of class |
slices |
An integer vector indicating the slices to subset |
... |
Further arguments passed to |
diffnet2net.args |
List of arguments passed to |
netdyn.args |
List of arguments passed to |
toavar |
Character scalar. Name of the vertex attribute that holds the times of adoption. |
graph.list |
A list of |
t0 |
Integer scalar. Passed to |
t1 |
Integer scalar. Passed to |
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.
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.
Other Foreign:
igraph
,
read_pajek()
,
read_ucinet_head()
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.