Install and load required package

Do you remember how to install and load a package? What are the two required functions?

Install and load the igraph package.

Create network data

The best way to code network data is to create an adjacency matrix.

Look at the network below and generate the corresponding adjacency matrix using excel or a similar software. Save the adjacency matrix as a csv file.

some text

Load your network data

Load your csv file using the read.csv() function. If you’re struggling finding the path to your csv file, try the function below:

csvPath <- file.choose()
csvPath
myAdjacencyMatrix <- read.csv(csvPath, header = TRUE)

Create your network graph:

g <- graph_from_adjacency_matrix(myAdjacencyMatrix, mode = "undirected")
plot(g, vertex.label = LETTERS[1:7], vertex.color = 1:7)

Now let’s play with graphical options

Find out how to modify: * vertex labels * vertex colors * vertex border colors * edge width * edge color * doted/dashed edges * edge labels * make curved edges * graph layout (?layout_)

Hint: ?igraph

When you’re happy with your graph, add a title to it and save it in vector format.