getNetwork function

Extract network of friends of authenticated user

Extract network of friends of authenticated user

getNetwork retrieves the list of mutual friendships and returns the adjacency matrix or edge list for the network representing the neighborhood of the authenticated user.

getNetwork(token, format = "edgelist", verbose = TRUE)

Arguments

  • token: Either a temporary access token created at https://developers.facebook.com/tools/explorer or the OAuth token created with fbOAuth.
  • format: Either "edgelist" for a list of edges in the network or "adj.matrix" for an adjacenty matrix of dimensions (n x n), with n being the number of friends, and 0 or 1 indicating whether friend i is also friends with friend j.
  • verbose: logical, default is TRUE, which will print additional information on the console.

Details

This function requires the use of an OAuth token with extended permissions.

After the introduction of version 2.0 of the Graph API, only friends who are using the application will be returned.

Examples

## Not run: ## See examples for fbOAuth to know how token was created. ## Copy and paste token created at FB Graph API Explorer token <- "XXXXXX" mat <- getNetwork(token=token, format="adj.matrix") library(igraph) network <- graph.adjacency(mat, mode="undirected") pdf("network_plot.pdf") plot(network) dev.off() ## End(Not run)

Author(s)

Pablo Barbera pablo.barbera@nyu.edu

See Also

getFriends, fbOAuth