The EI-Index is the division of the surplus count intra-group edges over inter-group edges, divided by total count of all edges. This implementation uses the intra-group and inter-group density instead of edge counts, when rescale is set to TRUE (default). The EI-Index is calculated for the whole network and for subgroups. Alternatively, the EI index can be employed as a measurement for egos tendency to homo-/heteorphily - use comp_ei(). for that variant of the EI-Index.

EI(object, alt.attr, include.ego = FALSE, ego.attr = alt.attr, rescale = TRUE)



An egor object.


Character naming grouping variable.


Logical. Include or exclude ego from EI calculation.


Character, naming the ego variable corresponding to ego.attr. Defaults to ego.attr.


Logical. If TRUE, the EI index calculation is rescaled, so that the EI is not distorted by differing group sizes.


Returns tibble with the following columns:

  • ego ID (".egoID")

  • network EI-Index ("ei")

  • subgroup EI-Index values (named by value levels of alt.attr/ego.attr)


The whole network EI is a metric indicating the tendency of a network to be clustered by the categories of a given factor variable (alt.attr). The EI value of a group describes the tendency of that group within a network to be connected (if between 0 and 1) or not connected (if between -1 and 0) to other groups. Differing group sizes can lead to a distortion of EI values i.e. the ability of a big group A to form relationships to much smaller group B is limited by the size of B. Even when all possible edges between A and B exist, the EI value for group A might still be negative, classifying it as homophile. The rescaled EI-Index values provided by this implementation substitutes absolute edge counts by inter- and intra-group edge densities in order to avoid the distortion of the EI-Index values. These values express the extend of homo- or heterophily of the network and its subgroups, as made possible by subgroup sizes.


Krackhardt, D., Stern, R.N., 1988. Informal networks and organizational crises: an experimental simulation. Social Psychology Quarterly 51 (2), 123-140.

Everett, M. G., & Borgatti, S. P. (2012). Categorical attribute based centrality: E-I and G-F centrality. Social Networks, 34(4), 562-569.

See also

comp_ei(), for an ego level homophily measure.


data("egor32") EI(egor32, "sex")
#> # A tibble: 32 x 4 #> .egoID ei m w #> <fct> <dbl> <dbl> <dbl> #> 1 1 0.28 0.250 1 #> 2 2 0.0537 0.0430 0.0886 #> 3 3 -0.110 -0.0849 -0.151 #> 4 4 0.0198 0.125 -0.150 #> 5 5 0.0191 0 0.176 #> 6 6 -0.160 -0.101 -0.245 #> 7 7 0.0931 0.0588 0.233 #> 8 8 0.0820 0.111 0.0244 #> 9 9 0.158 0.2 -0.333 #> 10 10 -0.0581 0.0588 -0.321 #> # … with 22 more rows