Solutions

Try figuring out the solutions yourself before looking them up here. All documentation required to answer the questions are located in the hyperlinks in the tutorial.

Power law and scale-free networks

The fit_power_law functions fits a power law to the degree distribution of the network. The values for the fit are compared to expected values with the Kolmogorov-Smirnov test. The null hypothesis for this test is that the degree distribution is drawn from a reference distribution. In this case, that reference distribution is generated from a power law.

The null hypothesis can only be rejected if the p-value of the test is below 0.05. Here, the p-value is 0.97. Therefore, we cannot conclude that the degree distribution is drawn from a different distribution than the power-law distribution.

Scale-free networks are networks with a degree distribution that follows a power law. Our result indicates that the network may be scale-free and contains nodes with a degree far larger than the average degree. While there is not that much known about the effect of scale-freeness on microbial networks, studies on the internet (for an example, see Cohen and colleagues, 2001) indicate that scale-freeness decreases the network’s sensitivity to random attacks. However, we still do not know to what extent biological networks follow a power law as we have few true biological networks. Lima-Mendez and van Helden (2009) discuss some of the weaknesses of this theory.

Betweenness centrality

The code snippet below shows how to calculate and plot betweenness centrality. If a node has low degree but connects two (or more) subcomponents of a network, it can have low degree but high betweenness centrality. In this case, we have one large central component and no clear subclusters. Therefore, the nodes that have higher degree tend to have higher betweenness centrality as well.

spiec.bet <- betweenness(spiec.graph)
hist(spiec.bet)

plot_network(spiec.graph, phyloseqobj.f, type='taxa', color="Rank3", label=NULL) + geom_point(aes(size=spiec.bet), colour='deepskyblue4', shape=1)

centralities <- data.frame(degree=spiec.deg, betweenness=spiec.bet)
ggplot(data=centralities, aes(x=degree, y=betweenness)) + geom_point() + geom_smooth(method='auto')

We can generate a toy network with one node that has high betweenness centrality, but only a degree of 2.

toy <- graph(edges=c(1, 2, 2, 3, 1, 3, 3, 4, 4, 5, 5, 6, 7, 6, 5, 7), directed=FALSE)
plot(toy)

degree(toy)
## [1] 2 2 3 2 3 2 2
betweenness(toy)
## [1] 0 0 8 9 8 0 0

Closeness centrality

We can remove small values caused by disconnected components to better visualize differences in the network. The network now shows that nodes at the periphery of the network have the lowest closeness centrality. There is one in particular that has an extremely low value; nearly all shortest paths from this node need to traverse 3 extra nodes to reach the central part of the network.

spiec.close <- closeness(spiec.graph)
spiec.close[spiec.close < 0.0001] = NA
hist(spiec.close, nint=35)

centralities$closeness <- spiec.close
centralities$closeness[spiec.close < 0.0001] = NA
ggplot(data=centralities, aes(x=degree, y=closeness)) + geom_point() + geom_smooth(method='auto')

plot_network(spiec.graph, phyloseqobj.f, type='taxa', color="Rank3", label=NULL) + geom_point(aes(size=spiec.close), colour='deepskyblue4', shape=1)