Fermenting bacteria (‘Fermenters’) consume carbohydrates and convert them into bacterial growth, carbon dioxide, hydrogen and other products (e.g. volatile fatty acids).
Methane producing archea (‘Methanogens’) use the hydrogen and the carbon dioxide to grow, producing methane and water in the process.
This process is typically found in the rumen (e.g. in cows, goats, horses, sheep etc ) and sometimes in the human gut.
nodes=cbind('id'=c('Fermenters','Methanogens','carbs','CO2','H2','other','CH4','H2O'),
'type'=c(rep('Microbe',2),rep('nonBio',6)))
nodes
## id type
## [1,] "Fermenters" "Microbe"
## [2,] "Methanogens" "Microbe"
## [3,] "carbs" "nonBio"
## [4,] "CO2" "nonBio"
## [5,] "H2" "nonBio"
## [6,] "other" "nonBio"
## [7,] "CH4" "nonBio"
## [8,] "H2O" "nonBio"
links=cbind('from'=c('carbs',rep('Fermenters',3),rep('Methanogens',2),'CO2','H2'),
'to'=c('Fermenters','other','CO2','H2','CH4','H2O',rep('Methanogens',2)),
'type'=c('uptake',rep('output',5),rep('uptake',2)),
'weight'=rep(1,8))
links
## from to type weight
## [1,] "carbs" "Fermenters" "uptake" "1"
## [2,] "Fermenters" "other" "output" "1"
## [3,] "Fermenters" "CO2" "output" "1"
## [4,] "Fermenters" "H2" "output" "1"
## [5,] "Methanogens" "CH4" "output" "1"
## [6,] "Methanogens" "H2O" "output" "1"
## [7,] "CO2" "Methanogens" "uptake" "1"
## [8,] "H2" "Methanogens" "uptake" "1"
library(igraph)
net = graph_from_data_frame(links,vertices = nodes,directed = T)
plot(net)
colrs.v = c(nonBio = "lightblue",Microbe = "gold") #node colours
V(net)$color = colrs.v[V(net)$type]
colrs.e = c(output = "grey", uptake = "magenta") #edge colours
E(net)$color = colrs.e[E(net)$type]
plot(net, edge.curved=0.2,vertex.size=30) #make nodes bigger, curve arrows
1/ The graphic shown in R (or Rstudio) is not the same as that which is shown in R markdown or R shiny.
2/ Vertices too close together
Solutions:
To increase space between vertices see: https://stackoverflow.com/questions/38999656/increasing-spaces-between-vertices-for-r-igraph
You can also specify exactly where you want the nodes: https://stackoverflow.com/questions/11272349/igraph-axes-xlim-ylim-plot-incorrectly
3/ Too much white space in the plot