Skip to main content
Log in

Generating directed networks with predetermined assortativity measures

  • OriginalPaper
  • Published:
Statistics and Computing Aims and scope Submit manuscript

Abstract

Assortativity coefficients are important metrics to analyze both directed and undirected networks. In general, it is not guaranteed that the fitted model will always agree with the assortativity coefficients in the given network, and the structure of directed networks is more complicated than the undirected ones. Therefore, we provide a remedy by proposing a degree-preserving rewiring algorithm, called DiDPR, for generating directed networks with given directed assortativity coefficients. We construct the joint edge distribution of the target network by accounting for the four directed assortativity coefficients simultaneously, provided that they are attainable, and obtain the desired network by solving a convex optimization problem. Our algorithm also helps check the attainability of the given assortativity coefficients. We assess the performance of the proposed algorithm by simulation studies with focus on two different network models, namely Erdös–Rényi and preferential attachment random networks. We then apply the algorithm to a Facebook wall post network as a real data example. The codes for implementing our algorithm are publicly available in R package wdnet (Yuan et al. in wdnet: Weighted and Directed Networks, University of Connecticut, R package version 0.0.5, https://CRAN.R-project.org/package=wdnet, 2022).

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10

Similar content being viewed by others

Explore related subjects

Discover the latest articles, news and stories from top researchers in related subjects.

References

  • Abbe, E.: Community detection and stochastic block models: recent developments. J. Mach. Learn. Res. 18(1), 6446–6531 (2017)

    MathSciNet  Google Scholar 

  • Barabási, A.L., Albert, R.: Emergence of scaling in random networks. Science 286(5439), 509–512 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  • Bertotti, M.L., Modanese, G.: The configuration model for Barábasi–Albert networks. Appl. Netw. Sci. 4, 32 (2019)

    Article  MATH  Google Scholar 

  • Bianconi, G., Gulbahce, N., Motter, A.E.: Local structure of directed networks. Phys. Rev. Lett. 100, 11 (2008)

    Article  Google Scholar 

  • Bollobás, B., Borgs, C., Chayes, J., Riordan, O.: Directed scale-free graphs. In: SODA ’03: Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, Philadelphia, PA, USA, pp. 132–139. SIAM (2003)

  • Boyd, S., Vandenberghe, L.: Convex Optimization. Cambridge University Press, Cambridge (2004)

    Book  MATH  Google Scholar 

  • Chang, H., Su, B.B., Zhou, Y.P., He, D.R.: Assortativity and act degree distribution of some collaboration networks. Physica A 383(2), 687–702 (2007)

    Article  Google Scholar 

  • Clauset, A., Shalizi, C.R., Newman, M.E.J.: Power-law distributions in empirical data. SIAM Rev. 51(4), 661–703 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  • Domahidi, A., Chu, E., Boyd, S.: ECOS: An SOCP solver for embedded systems. In: 2013 European Control Conference (ECC), Piscataway, NJ, USA, pp. 3071–3076. IEEE (2013)

  • Erdös, P., Rényi, A.: On random graphs I. Publicationes Mathematicae Debrecen 6, 290–297 (1959)

    MathSciNet  MATH  Google Scholar 

  • Fisher, D.N., Silk, M.J., Franks, D.W.: The Perceived Assortativity of Social Networks: Methodological Problems and Solutions, pp. 1–19. Springer International Publishing, Cham (2017)

    Google Scholar 

  • Foster, J.G., Foster, D.V., Grassberger, P., Paczuski, M.: Edge direction and the structure of networks. Proc. Natl. Acad. Sci. U.S.A. 107(24), 10815–10820 (2010)

    Article  Google Scholar 

  • Fu, A., Narasimhan, B., Boyd, S.: CVXR: an R package for disciplined convex optimization. J. Stat. Softw. 94(14), 1–34 (2020)

    Article  Google Scholar 

  • Gilbert, E.N.: Random graphs. Ann. Math. Stat. 30(4), 1141–1144 (1959)

    Article  MATH  Google Scholar 

  • Gillespie, C.S.: Fitting heavy tailed distributions: the poweRlaw package. J. Stat. Softw. 64(2), 1–16 (2015)

    Article  Google Scholar 

  • Holme, P., Zhao, J.: Exploring the assortativity-clustering space of a network’s degree sequence. Phys. Rev. E 75(4), 046111 (2007)

    Article  Google Scholar 

  • Kashyap, G., Ambika, G.: Mechanisms for tuning clustering and degree-correlations in directed networks. J. Complex Netw. 6(5), 767–787 (2017)

    Article  MathSciNet  Google Scholar 

  • Krapivsky, P.L., Redner, S.: Organization of growing random networks. Phys. Rev. E 63(6), 066123 (2001)

    Article  Google Scholar 

  • Krapivsky, P.L., Rodgers, G.J., Redner, S.: Degree distributions of growing networks. Phys. Rev. Lett. 86(23), 5401–5404 (2001)

    Article  Google Scholar 

  • Kunegis, J.: KONECT: the Koblenz network collection. In: Schwabe, D., Almeida, V., Glaser, H. (Eds.) WWW ’13 Companion: Proceedings of the 22nd International Conference on World Wide Web, New York, NY, USA, pp. 1343–1350. Association for Computing Machinery (2013)

  • Leung, C.C., Chau, H.F.: Weighted assortative and disassortative networks model. Physica A 378(2), 591–602 (2007)

    Article  Google Scholar 

  • Litvak, N., van der Hofstad, R.: Uncovering disassortativity in large scale-free networks. Phys. Rev. E 87(2), 022801 (2013)

    Article  Google Scholar 

  • Newman, M.E.J.: Assortative mixing in networks. Phys. Rev. Lett. 89(20), 208701 (2002)

    Article  Google Scholar 

  • Newman, M.E.J.: Mixing patterns in networks. Phys. Rev. E 67(2), 026126 (2003)

    Article  MathSciNet  Google Scholar 

  • Noldus, R., van Mieghem, P.: Assortativity in complex networks. J. Complex Netw. 3(4), 507–542 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  • Palla, G., Farkas, I.J., Pollner, P., Derényi, I., Vicsek, T.: Directed network modules. New J. Phys. 9, 186 (2015)

    Article  Google Scholar 

  • Piraveenan, M., Prokopenko, M., Zomaya, A.: Assortative mixing in directed biological networks. IEEE/ACM Trans. Comput. Biol. Bioinf. 9(1), 66–78 (2010)

    Article  Google Scholar 

  • Piraveenan, M., Prokopenko, M., Zomaya, A.: Assortative mixing in directed biological networks. IEEE/ACM Trans. Comput. Biol. Bioinf. 9(1), 66–78 (2012)

    Article  MATH  Google Scholar 

  • Sendiña-Nadal, I., Danziger, M.M., Wang, Z., Havlin, S., Boccaletti, S.: Assortativity and leadership emerge from anti-preferential attachment in heterogeneous networks. Sci. Rep. 6(1), 1–7 (2016)

    Article  Google Scholar 

  • Shirado, H., Iosifidis, G., Christakis, N.A.: Assortative mixing and resource inequality enhance collective welfare in sharing networks. Proc. Natl. Acad. Sci. 116(45), 22442–22444 (2019)

    Article  Google Scholar 

  • Uribe-Leon, C., Vasquez, J.C., Giraldo, M.A., Ricaurte, G.: Finding optimal assortativity configurations in directed networks. J. Complex Netw. 8(6), cnab004 (2021)

    Article  MathSciNet  Google Scholar 

  • van der Hofstad, R.: Random Graphs and Complex Networks. Cambridge University Press, Cambridge (2017)

  • van der Hoorn, P., Litvak, N.: Degree-degree dependencies in directed networks with heavy-tailed degrees. Internet Math. 11(2), 155–179 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  • Wan, P., Wang, T., Davis, R.A., Resnick, S.I.: Fitting the linear preferential attachment model. Electron. J. Stat. 11, 3738–3780 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  • Wan, P., Wang, T., Davis, R.A., Resnick, S.I.: Are extreme value estimation methods useful for network data? Extremes 23(1), 171–195 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  • Wang, T., Resnick, S.I.: Common growth patterns for regional social networks: A point process approach. J. Data Sci. (2021). https://doi.org/10.6339/21-JDS1021

    Article  Google Scholar 

  • Wang, T., Resnick, S.I.: Measuring reciprocity in a directed preferential attachment network. Adv. Appl. Probab. (2022). https://doi.org/10.1017/apr.2021.52

    Article  Google Scholar 

  • Yuan, Y., Wang, T., Yan, J., Zhang, P.: wdnet: Weighted and Directed Networks. University of Connecticut. R package version 0.0.5, https://CRAN.R-project.org/package=wdnet (2022)

  • Yuan, Y., Yan, J., Zhang, P.: Assortativity measures for weighted and directed networks. J. Complex Netw. 9(2), cnab017 (2021)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Panpan Zhang.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Tiandong Wang, Jun Yan, Yelie Yuan, Panpan Zhang contributed equally to this manuscript.

Appendices

Appendix A: Interface with CVXR package

As mentioned, we use the utility functions from CVXR package to solve the optimization problem defined in Sect. 2.2. The linear constraints of those functions are represented by vectors and matrices in the description file of CVXR. We hence write the constraints for our optimization problem in the form of matrices as well. Let \({\varvec{k}}\) and \({\varvec{l}}\) respectively be the collection of distinct out-degree and in-degree values in G(VE). Recall that we use \(q_k^{(1)}\) to represent the probability that an edge emanates from a source node of out-degree k. In what follows, let the \(|{\varvec{k}}|\)-long vector \({\varvec{q}}^{(1)} := (q_{k}^{(1)})^\top \) denote the empirical out-degree distribution for source nodes, \({\varvec{{\tilde{q}}}}^{(1)} := ({\tilde{q}}_{k}^{(1)})^\top \) denote the empirical out-degree distribution for target nodes, where \(|{\varvec{k}}|\) is the cardinality of vector \({\varvec{k}}\), and \({\varvec{v}}^{\top }\) is the transpose of \({\varvec{v}}\). In what follows, we define \({\varvec{q}}^{(2)} := (q_{l}^{(2)})^\top \) and \({\varvec{{\tilde{q}}}}^{(2)} := ({\tilde{q}}_{l}^{(2)})^\top \) in a similar manner. Consider two design matrices respectively given by \({\varvec{R}}:= {\varvec{I}}_{|{\varvec{k}}|\times |{\varvec{k}}|} \otimes {\varvec{1}}_{|{\varvec{l}}|}^{\top }\) and \({\varvec{S}}:= {\varvec{1}}_{|{\varvec{k}}|}^{\top } \otimes {\varvec{I}}_{|{\varvec{l}}|\times |{\varvec{l}}|}\), where \({\varvec{I}}_{|{\varvec{k}}|\times |{\varvec{k}}|}\) is a \(|{\varvec{k}}|\times |{\varvec{k}}|\) identity matrix, \({\varvec{1}}_{|{\varvec{l}}|}\) is an \(|{\varvec{l}}|\)-long column vector consisting of all ones, and \(\otimes \) represents Kronecker product. Lastly, we use \({\varvec{K}}\) to denote a \(|{\varvec{k}}|\times |{\varvec{l}}|\) matrix, each column of which is \({\varvec{k}}\). Analogously, \({\varvec{L}}\) is defined as a \(|{\varvec{l}}|\times |{\varvec{k}}|\) matrix that is composed of \({\varvec{l}}\)’s.

For the sake of implementation, we arrange all the quantities in \({\varvec{\eta }}\) in the following matrix:

$$\begin{aligned} {\varvec{H}} = \begin{pmatrix} \eta _{k_1 l_1 k_1 l_1} &{} \eta _{k_1 l_1 k_1 l_2} &{} \cdots &{} \eta _{k_1 l_1 k_{|{\varvec{k}}|} l_{|{\varvec{l}}|}} \\ \eta _{k_1 l_2 k_1 l_1} &{} \eta _{k_1 l_2 k_1 l_2} &{} \cdots &{} \eta _{k_1 l_2 k_{|{\varvec{k}}|} l_{|{\varvec{l}}|}} \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \eta _{k_{|{\varvec{k}}|} l_{|{\varvec{l}}|} k_1 l_1} &{} \eta _{k_{|{\varvec{k}}|} l_{|{\varvec{l}}|} k_1 l_2} &{} \cdots &{} \eta _{k_{|{\varvec{k}}|} l_{|{\varvec{l}}|} k_{|{\varvec{k}}|} l_{|{\varvec{l}}|}} \end{pmatrix}, \end{aligned}$$

which is of dimension \((|{\varvec{k}}||{\varvec{l}}|) \times (|{\varvec{k}}||{\varvec{l}}|)\). We are now ready to rewrite the constraints for our convex optimization problems as follows:

$$\begin{aligned}&{\varvec{H}} \ge 0, \\&{\varvec{H}} {\varvec{1}}_{|{\varvec{k}}||{\varvec{l}}|} = \frac{{\mathbf {vec}}\left( ({\varvec{K}}\odot {\varvec{\nu }})^\top \right) }{{\varvec{1}}_{|{\varvec{k}}|}^{\top } ({\varvec{K}}\odot {\varvec{\nu }}) {\varvec{1}}_{|{\varvec{l}}|}}, \quad {\varvec{H}}^\top {\varvec{1}}_{|{\varvec{k}}||{\varvec{l}}|} = \frac{{\mathbf {vec}}\left( {\varvec{L}}\odot {\varvec{\nu }}^\top \right) }{{\varvec{1}}_{|{\varvec{l}}|}^{\top } ({\varvec{L}}\odot {\varvec{\nu }}^\top ) {\varvec{1}}_{|{\varvec{k}}|}}, \\&r^*(1, 1) = \frac{{\varvec{k}}^\top \left( {\varvec{RHR}}^\top - {\varvec{q}}^{(1)}({\varvec{{\tilde{q}}}}^{(1)})^\top \right) {\varvec{k}}}{\sigma _q^{(1)}\sigma _{{\tilde{q}}}^{(1)}},\\&r^*(1, 2) = \frac{{\varvec{k}}^\top \left( {\varvec{RHS}}^\top - {\varvec{q}}^{(1)}({\varvec{{\tilde{q}}}}^{(2)})^\top \right) {\varvec{l}}}{\sigma _q^{(1)} \sigma _{{\tilde{q}}}^{(2)}}, \\&r^*(2, 1) = \frac{{\varvec{l}}^\top \left( {\varvec{SHR}}^\top - {\varvec{q}}^{(2)}({\varvec{{\tilde{q}}}}^{(1)})^\top \right) {\varvec{k}}}{\sigma _q^{(2)} \sigma _{{\tilde{q}}}^{(1)}},\\&r^*(2, 2) = \frac{{\varvec{l}}^\top \left( {\varvec{SHS}}^\top - {\varvec{q}}^{(2)}({\varvec{{\tilde{q}}}}^{(2)})^\top \right) {\varvec{l}}}{\sigma _q^{(2)} \sigma _{{\tilde{q}}}^{(2)}}, \end{aligned}$$

where \(\odot \) represents element-wise product and \({\mathbf {vec}}(\cdot )\) is matrix vectorization operator.

Fig. 11
figure 11

Side-by-side boxplots for the total increase in assortativity coefficients under different rewiring scenarios from DPA networks with \(\alpha = 0.3\), \(\beta = 0.4\), \(\gamma = 0.3\) (left panel) and \(\alpha = 0.1\), \(\beta = 0.2\), \(\gamma = 0.7\) (right panel)

Appendix B: Probability rules for generating PA networks

The growth of PA networks is governed by a collection of parameters \({\varvec{\theta }}= (\alpha , \beta , \gamma , \delta _{\, {\mathrm{in}}}, \delta _{\, {\mathrm{out}}})\). Let \(t \ge 0\) index the time, \(G_{t + 1} (V_{t + 1}, E_{t + 1})\) is generated by adding an edge to \(G_t (V_t, E_t)\) according to one of the following scenarios. Recall that \(d_v^{(1)}\) and \(d_v^{(2)}\) respectively represent the in- and out-degree of node v.

  1. 1.

    With probability \(\alpha \), a new directed edge \((v_1, v_2)\) is added from a new node \(v_1 \in V_{t + 1} \setminus V_t\) to an existing node \(v_2 \in V_t\), where \(v_2\) is chosen with probability

    $$\begin{aligned} \Pr (\text{ choose } v_2 \in V_t) = \frac{d^{\, (2)}_{v_2} + \delta _{\, {\mathrm{in}}}}{\sum _{v \in V_t} \left( d^{\, (2)}_v + \delta _{\, {\mathrm{in}}}\right) }; \end{aligned}$$
  2. 2.

    With probability \(\beta \), a new directed edge \((v_1, v_2)\) is added between existing nodes from \(v_1 \in V_{t + 1} = V_t\) to \(v_2 \in V_{t + 1} = V_t\), where \(v_1\) and \(v_2\) are chosen independently with probability

    $$\begin{aligned}&\Pr (\text{ choose } v_1, v_2 \in V_t) \\&\quad = \left[ \frac{d^{\, (1)}_{v_1} + \delta _{\, {\mathrm{out}}}}{\sum _{v \in V_t} \left( d^{\, (1)}_v + \delta _{\, {\mathrm{out}}}\right) }\right] \left[ \frac{d^{\, (2)}_{v_2} + \delta _{\, {\mathrm{in}}}}{\sum _{v \in V_t} \left( d^{\, (2)}_v + \delta _{\, {\mathrm{in}}}\right) }\right] ; \end{aligned}$$
  3. 3.

    With probability \(\gamma \), a new directed edge \((v_1, v_2)\) is added from an existing node \(v_1 \in V_t\) to a new node \(v_2 \in V_{t + 1} \setminus V_t\), where \(v_1\) is chosen with probability

    $$\begin{aligned} \Pr (\text{ choose } v_1 \in V_t) = \frac{d^{\, (1)}_{v_1} + \delta _{\, {\mathrm{out}}}}{\sum _{v \in V_t} \left( d^{\, (1)}_v + \delta _{\, {\mathrm{out}}}\right) }. \end{aligned}$$

Appendix C: Increases in assortativity coefficients under different scenarios

Through simulation examples, we compare the increases in all four assortativity coefficients for DPA networks contributed by different rewiring scenarios, i.e., \(\alpha \)-\(\alpha \), \(\alpha \)-\(\beta \), \(\alpha \)-\(\gamma \), \(\beta \)-\(\beta \), \(\beta \)-\(\gamma \) and \(\gamma \)-\(\gamma \) scenarios. In Fig. 11, we present the results from: (1) \(\alpha = 0.3, \beta = 0.4, \gamma = 0.3\) under the \(\alpha = \gamma \) setting and; (2) \(\alpha = 0.1, \beta = 0.2, \gamma = 0.7\) under the setting of fixed \(\beta \).

Though the chosen value of \(\beta \) in the first case (left panel) is larger, leading to a limited number of edges generated from the \(\alpha \)- and \(\gamma \)-scenarios, the contributions to the increases in all four types of assortativity coefficients by \(\alpha \)-\(\gamma \) are still greater than the other combinations. In the second case (right panel), we also see more contribution by \(\alpha \)-\(\gamma \) when the value of \(\beta \) decreases to 0.2. Note that the presented example is with the smallest value of \(\alpha \gamma \) among all in the setting of fixed \(\beta = 0.2\), so that a greater amount of increase in assortativity coefficients is expected when \(\alpha \gamma \) gets large. Therefore, we conclude that the simulation results are in support of our elaborations in Sect. 3.2.

Rights and permissions

Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wang, T., Yan, J., Yuan, Y. et al. Generating directed networks with predetermined assortativity measures. Stat Comput 32, 91 (2022). https://doi.org/10.1007/s11222-022-10161-8

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11222-022-10161-8

Keywords

Navigation