The igraph R package can be installed just like any other R packages. Perhaps the easiest way is to use the install.packages() command. This downloads either a source of binary package appropriate for the running system from CRAN and installs it by default to the system directories. The package can be loaded by typing


after installation.

If the user doesn't have rights to write to system directories the lib argument of the install.packages() command can be used to set an alternate installation directory. It is good R practice to keep the user's privately installed packages in a separate directory (say ~/.R/library), if this is the case igraph can be installed like this:

install.packages("igraph", lib="~/.R/library")

The R package search path needs to be modified as well to let R know about our private package directory:

.libPaths( c("~/.R/library", .libPaths()) )

This command can also be added to the ~/.Rprofile file to set the search path automatically every time you start R.

See ?Startup and ?.libPaths() for more information about R's startup mechanism and the way directories are searched for packages and ?install.packages about installing R packages.