In this lab, you'll practice some of the introductory skills for NetworkX introduced in the previous lesson. To do this, you'll create a graph to visualize users and businesses from yelp reviews.
You will be able to:
- Create basic network graphs using NetworkX
- Add nodes to network graphs with NetworkX
- Add edges to network graphs with NetworkX
- Visualize network graphs with NetworkX
To start, import the data stored in the file 'Yelp_reviews.csv'
#Your code here
Now, create an initial graph!
#Your code here
Create a node for each user and each business in the dataset. Networks with multiple node types like this are called bimodal networks.
Optionally, go further by creating a list of colors for when you visualize the graph. If you do this, append the color "green" to your color list every time you add a user node and append the color "blue" to your color list every time you add a business node.
#Your code here
Next, iterate through the dataset and create an edge between users and the businesses they have reviewed.
#Your code here
Finally, create a visualization of your network. If you chose to color your nodes, pass the list of colors through the optional node_color
parameter.
#Your code here
Nice work! In this lab you created an initial network to visualize a bimodal network of businesses and yelp reviewers!