graphab_modul: Create modules from a graph in the Graphab project

View source: R/graphab_modul.R

graphab_modulR Documentation

Create modules from a graph in the Graphab project


The function creates modules from a graph by maximising modularity


  prob = 0.05,
  beta = 1,
  nb = NULL,
  return = TRUE,
  proj_path = NULL,
  alloc_ram = NULL



A character string indicating the Graphab project name. The project name is also the name of the project directory in which the file proj_name.xml is.


A character string indicating the name of the graph on which the modularity index is computed. This graph has been created with Graphab or using graphab_graph function and is associated with a link set. Only the links present in the graph and their corresponding weights will be used in the computation, together with patch areas.


A numeric or integer value specifying the distance at which dispersal probability is equal to prob. This argument is mandatory for weighted metrics (PC, F, IF, BC, dPC, CCe, CF) but not used for others. It is used to set α for computing dispersal probabilities associated with all inter-patch distances such that dispersal probability between patches i and j is p_{ij}= e^{-α d_{ij}}.


A numeric or integer value specifying the dispersal probability at distance dist. By default, code=0.05. It is used to set α (see param dist above).


A numeric or integer value between 0 and 1 specifying the exponent associated with patch areas in the computation of metrics weighted by patch area. By default, beta=1. When beta=0, patch areas do not have any influence in the computation.


(optional, default=NULL) An integer or numeric value indicating the number of modules to be created. By default, it is the number that maximises the modularity index.


Logical (default=TRUE) indicating whether results are returned to user.


(optional) A character string indicating the path to the directory that contains the project directory. It should be used when the project directory is not in the current working directory. Default is NULL. When 'proj_path = NULL', the project directory is equal to getwd().


(optional, default = NULL) Integer or numeric value indicating RAM gigabytes allocated to the java process. Increasing this value can speed up the computations. Too large values may not be compatible with your machine settings.


This function maximises a modularity index by searching for the node partition involves a large number of links within modules and a small number of inter-module links. Each link is given a weight in the computation, such as the weight w_{ij} of the link between patches i and j is:

w_{ij} = (a_{i} a_{j})^β e^{-α d_{ij}}

. This function does not allow users to convert automatically Euclidean distances into cost-distances. See more information in Graphab 2.8 manual:


If return=TRUE, the function returns a message indicating whether the partition has been done. New options are being developed.


P. Savary


## Not run: 
graphab_modul(proj_name = "grphb_ex",
               graph = "graph",
               dist = 1000,
               prob = 0.05,
               beta = 1)

## End(Not run)

graph4lg documentation built on Feb. 16, 2023, 5:43 p.m.