Create a network from an edgelist
In this exercise, you will create a network from an edgelist.
You will create an igraph object from data stored in an edgelist using the function graph_from_data_frame(). The data is a social network of customers and each row of the edgeList dataframe represents an edge in the network. The edges in this network are undirected and have weight 1. This is indicated by the directed argument of the function, which is logical so the value FALSE means that the network is undirected.
The igraph package has been loaded for you.
Deze oefening maakt deel uit van de cursus
Predictive Analytics using Networked Data in R
Oefeninstructies
- Inspect the first rows of the
edgeListdataframe using thehead()function. - Create an
igraphobject callednetworkwith theedgeListdataframe using thegraph_from_dataframe()function. Use the logicaldirectedargument to specify that the network is undirected. - Inspect the
igraphobject you created by calling its name.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Inspect edgeList
head(___)
# Construct the igraph object
network <- graph_from_data_frame(___, directed = ___)
# View your igraph object
___