sample_graph: Simulate Sampling on Network Graph

View source: R/sample_graph.R

sample_graphR Documentation

Simulate Sampling on Network Graph

Description

Simulates network sampling, monitoring and performs community detection based on the simple ratio index.

Usage

sample_graph(
  graph,
  sample_nNodes,
  sampling_duration,
  prop_hi_res = 1,
  hi_res = 1,
  lo_res = 1/7,
  regime = "grab-two",
  alg = "fast_greedy"
)

Arguments

graph

The true network to sample.

sample_nNodes

The number of individuals to sample.

sampling_duration

The number of days to monitor sampled individuals.

prop_hi_res

The proportion of sampled nodes to monitor with high resolution.

hi_res

The observation frequency of the high resolution individuals, expressed as the number of observations per day.

lo_res

The observation frequency of the low resolution individuals, expressed as the number of observations per day.

regime

The sampling regime to use: options include "random", "even", "grab-two".

alg

The community detection algorithm to use, one of: "netcarto", "fast_greedy", "label_prop", "leiden", "louvain", "walktrap".

Value

An igraph graph of the sampled network where edge weights ('attr' = "weight") is the simple ratio index.

Examples


g <- simulate_graph(n_animals = 25,
                    n_groups = 4,
                    time_to_leave = 5,
                    time_to_return = 2,
                    travel_time = c(0.001,0.2),
                    sampling_duration = 7,
                    sampler = "discrete",
                    samples_per_day = 1
                    )
g_obs <- sample_graph(
  graph = g,
  sample_nNodes = 10,
  prop_hi_res = 1,
  hi_res = 2,
  sampling_duration = 7,
  regime = "random",
  alg = "fast_greedy")



gavincotterill/modulr documentation built on Nov. 30, 2022, 11:15 p.m.