This repository contains R code for constructing and analyzing dominance networks using adjacency matrices and weight/abundance data. The original project is based on observational data of animal interactions and dominance behavior. To protect sensitive information, we provide simulated example datasets that match the structure of the real data.
DominanceNetworkAnalysis/
βββ data/
β βββ fake_adjacency_matrix.csv # Simulated adjacency matrix
β βββ fake_weights_abundance.csv # Simulated weight and abundance data
βββ R/
β βββ dominance_network_analysis.R # Main analysis script
βββ README.md
βββ LICENSE
- Loads and processes directed, weighted adjacency matrices.
- Constructs and visualizes dominance networks using
igraph
. - Annotates nodes with species' weight and abundance.
- Calculates hub and authority scores.
- Applies the
Perc
package for dominance ranking simulations. - Computes network indices (e.g., density, reciprocity, centrality).
The network plots show individuals as nodes. Node size reflects species weight, and node color intensity indicates abundance. Edge width and color represent interaction weight.
The following R packages are used:
igraph
β for network creation and analysisPerc
β for probabilistic dominance and ranking analysisggplot2
(optional, for any visual extensions)
Install them via:
install.packages("igraph")
install.packages("Perc")
- Clone or download this repository.
- Open the script in
R/R/dominance_network_analysis.R
. - Make sure the working directory points to the root of the project.
- Run the script. It will load the data in
/data/
and produce visualizations and outputs.
We provide two example files in the data/
folder:
fake_adjacency_matrix.csv
: A 10x10 matrix representing directed interactions between individuals.fake_weights_abundance.csv
: Contains speciesWeight
andAbundance
for node attribute mapping.
These datasets are entirely artificial and provided solely for reproducibility of the script.
This code was developed for a scientific study on dominance hierarchies and social structure in free-living hummingbirds. The real data consist of observed agonistic interactions coded into adjacency matrices across different days and months.
This project is licensed under the MIT License β see the LICENSE file for details.
Ana Melisa Fernandes
fernandesanameli@gmail.com