Skip to content

Add method for snowball sampling #13

Description

@alexpghayes

Basically BFS, something along the lines of

sample_snowball <- function(
  users, hops,
  direction = c(
    "following",
    "followed-by",
    "both"
  )) {

  if (hops < 0)
    stop("`hops` must be greater than zero.")

  direction <- rlang::arg_match(direction)

  for (user in users)
    if (!users_in_cache(user))
      add_users_to_cache(user)

  # TODO: respect direction in the future

  friends <- cache_get_friends(users)

  sample_snowball(friends, hops - 1)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions