<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html > <head><title>1.2.3.0 knn_q_from_layers.py</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> <meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> <!-- html,index=2,3,4,5,next --> <meta name="src" content="mammult_doc.tex"> <meta name="date" content="2015-10-19 16:26:00"> <link rel="stylesheet" type="text/css" href="mammult_doc.css"> </head><body > <!--l. 3--><div class="crosslinks"><p class="noindent">[<a href="mammult_docsu34.html" >next</a>] [<a href="mammult_docsu32.html" >prev</a>] [<a href="mammult_docsu32.html#tailmammult_docsu32.html" >prev-tail</a>] [<a href="#tailmammult_docsu33.html">tail</a>] [<a href="mammult_docsu31.html#mammult_docsu33.html" >up</a>] </p></div> <h5 class="subsubsectionHead"><a id="x37-360001.2.3"></a><span class="cmtt-10x-x-109">knn</span><span class="cmtt-10x-x-109">_q</span><span class="cmtt-10x-x-109">_from</span><span class="cmtt-10x-x-109">_layers.py</span></h5> <!--l. 3--><p class="noindent" ><span class="cmbx-10x-x-109">NAME</span> <!--l. 3--><p class="indent" > <span class="cmbx-10x-x-109">knn</span><span class="cmbx-10x-x-109">_q</span><span class="cmbx-10x-x-109">_from</span><span class="cmbx-10x-x-109">_layers.py </span>- compute intra-layer and inter-layer degree-degree correlation coefficients. <!--l. 3--><p class="noindent" ><span class="cmbx-10x-x-109">SYNOPSYS</span> <!--l. 3--><p class="indent" > <span class="cmbx-10x-x-109">knn</span><span class="cmbx-10x-x-109">_q</span><span class="cmbx-10x-x-109">_from</span><span class="cmbx-10x-x-109">_layers.py </span><span class="cmmi-10x-x-109"><</span><span class="cmitt-10x-x-109">layer1</span><span class="cmmi-10x-x-109">> <</span><span class="cmitt-10x-x-109">layer2</span><span class="cmmi-10x-x-109">></span> <!--l. 43--><p class="noindent" ><span class="cmbx-10x-x-109">DESCRIPTION</span> <!--l. 43--><p class="indent" > Compute the intra-layer and the inter-layer degree correlation functions for two layers given as input. The intra-layer degree correlation function quantifies the presence of degree-degree correlations in a single layer network, and is defined as: <table class="equation-star"><tr><td> <center class="math-display" > <img src="mammult_doc6x.png" alt=" --1- ∑ ′ ′ ⟨knn(k)⟩ = kNk k P(k |k ) k′ " class="math-display" ></center></td></tr></table> <!--l. 43--><p class="nopar" > <!--l. 43--><p class="indent" > where <span class="cmmi-10x-x-109">P</span>(<span class="cmmi-10x-x-109">k</span><span class="cmsy-10x-x-109">′|</span><span class="cmmi-10x-x-109">k</span>) is the probability that a neighbour of a node with degree <span class="cmmi-10x-x-109">k </span>has degree <span class="cmmi-10x-x-109">k</span><span class="cmsy-10x-x-109">′</span>, and <span class="cmmi-10x-x-109">N</span><sub><span class="cmmi-8">k</span></sub> is the number of nodes with degree <span class="cmmi-10x-x-109">k</span>. The quantity <span class="cmsy-10x-x-109">⟨</span><span class="cmmi-10x-x-109">k</span><sub><span class="cmmi-8">nn</span></sub>(<span class="cmmi-10x-x-109">k</span>)<span class="cmsy-10x-x-109">⟩ </span>is the average degree of the neighbours of nodes having degree equal to <span class="cmmi-10x-x-109">k</span>. <!--l. 43--><p class="indent" > If we consider two layers of a multiplex, and we denote by <span class="cmmi-10x-x-109">k </span>the degree of a node on the first layer and by <span class="cmmi-10x-x-109">q </span>the degree of the same node on the second layers, the inter-layer degree correlation function is defined as <table class="equation-star"><tr><td> <center class="math-display" > <img src="mammult_doc7x.png" alt="-- ∑ ′ ′ k(q) = k P(k |q) k′ " class="math-display" ></center></td></tr></table> <!--l. 43--><p class="nopar" > <!--l. 43--><p class="indent" > where <span class="cmmi-10x-x-109">P</span>(<span class="cmmi-10x-x-109">k</span><span class="cmsy-10x-x-109">′|</span><span class="cmmi-10x-x-109">q</span>) is the probability that a node with degree <span class="cmmi-10x-x-109">q </span>on the second layer has degree equal to <span class="cmmi-10x-x-109">k</span><span class="cmsy-10x-x-109">′ </span>on the first layer, and <span class="cmmi-10x-x-109">N</span><sub><span class="cmmi-8">q</span></sub> is the number of nodes with degree <span class="cmmi-10x-x-109">q </span>on the second layer. The quantity <span class="overline"><span class="cmmi-10x-x-109">k</span></span>(<span class="cmmi-10x-x-109">q</span>) is the expected degree at layer 1 of node that have degree equal to <span class="cmmi-10x-x-109">q </span>on layer 2. The dual quantity: <table class="equation-star"><tr><td> <center class="math-display" > <img src="mammult_doc8x.png" alt="-- ∑ ′ ′ q(k) = q P(q |k) q′ " class="math-display" ></center></td></tr></table> <!--l. 43--><p class="nopar" > <!--l. 43--><p class="indent" > is the average degree on layer 2 of nodes having degree <span class="cmmi-10x-x-109">k </span>on layer 1. <!--l. 73--><p class="noindent" ><span class="cmbx-10x-x-109">OUTPUT</span> <!--l. 73--><p class="indent" > The program creates two output files, respectively called <!--l. 73--><p class="indent" >   <span class="cmti-10x-x-109">file1</span><span class="cmti-10x-x-109">_file2</span><span class="cmti-10x-x-109">_k1</span> <!--l. 73--><p class="indent" > and <!--l. 73--><p class="indent" >   <span class="cmti-10x-x-109">file1</span><span class="cmti-10x-x-109">_file2</span><span class="cmti-10x-x-109">_k2</span> <!--l. 73--><p class="indent" > The first file contains a list of lines in the format: <!--l. 73--><p class="indent" >   <span class="cmti-10x-x-109">k </span><span class="cmsy-10x-x-109">⟨</span><span class="cmmi-10x-x-109">k</span><sub><span class="cmmi-8">nn</span></sub>(<span class="cmmi-10x-x-109">k</span>)<span class="cmsy-10x-x-109">⟩ </span><span class="cmmi-10x-x-109">σ</span><sub><span class="cmmi-8">k</span></sub> <span class="overline"><span class="cmmi-10x-x-109">q</span></span>(<span class="cmmi-10x-x-109">k</span>) <span class="cmmi-10x-x-109">σ</span><sub><span class="overline"><span class="cmmi-10x-x-109">q</span></span></sub> <!--l. 73--><p class="indent" > where <span class="cmmi-10x-x-109">k </span>is the degree at first layer, <span class="cmsy-10x-x-109">⟨</span><span class="cmmi-10x-x-109">k</span><sub><span class="cmmi-8">nn</span></sub>(<span class="cmmi-10x-x-109">k</span>)<span class="cmsy-10x-x-109">⟩ </span>is the average degree of the neighbours at layer 1 of nodes having degree <span class="cmmi-10x-x-109">k </span>at layer 1, <span class="cmmi-10x-x-109">σ</span><sub><span class="cmmi-8">k</span></sub> is the standard deviation associated to <span class="cmsy-10x-x-109">⟨</span><span class="cmmi-10x-x-109">k</span><sub><span class="cmmi-8">nn</span></sub>(<span class="cmmi-10x-x-109">k</span>)<span class="cmsy-10x-x-109">⟩</span>, <span class="overline"><span class="cmmi-10x-x-109">q</span></span>(<span class="cmmi-10x-x-109">k</span>) is the average degree at layer 2 of nodes having degree equal to <span class="cmmi-10x-x-109">k </span>at layer 1, and <span class="cmmi-10x-x-109">σ</span><sub><span class="overline"><span class="cmmi-10x-x-109">q</span></span></sub> is the standard deviation associated to <span class="overline"><span class="cmmi-10x-x-109">q</span></span>(<span class="cmmi-10x-x-109">k</span>). <!--l. 73--><p class="indent" > The second file contains a similar list of lines, in the format: <!--l. 73--><p class="indent" >   <span class="cmti-10x-x-109">q </span><span class="cmsy-10x-x-109">⟨</span><span class="cmmi-10x-x-109">q</span><sub><span class="cmmi-8">nn</span></sub>(<span class="cmmi-10x-x-109">q</span>)<span class="cmsy-10x-x-109">⟩ </span><span class="cmmi-10x-x-109">σ</span><sub><span class="cmmi-8">q</span></sub> <span class="overline"><span class="cmmi-10x-x-109">k</span></span>(<span class="cmmi-10x-x-109">q</span>) <span class="cmmi-10x-x-109">σ</span><sub><span class="overline"><span class="cmmi-10x-x-109">k</span></span></sub> <!--l. 73--><p class="indent" > with obvious meaning. <!--l. 80--><p class="noindent" ><span class="cmbx-10x-x-109">REFERENCE</span> <!--l. 80--><p class="indent" > V. Nicosia, V. Latora, “Measuring and modeling correlations in multiplex networks”, <span class="cmti-10x-x-109">Phys. Rev. E </span><span class="cmbx-10x-x-109">92</span>, 032805 (2015). <!--l. 80--><p class="indent" > Link to paper: <a href="http://journals.aps.org/pre/abstract/10.1103/PhysRevE.92.032805" class="url" ><span class="cmtt-10x-x-109">http://journals.aps.org/pre/abstract/10.1103/PhysRevE.92.032805</span></a> <!--l. 80--><p class="indent" > V. Nicosia, G. Bianconi, V. Latora, M. Barthelemy, “Growing multiplex networks”, <span class="cmti-10x-x-109">Phys. Rev. Lett. </span><span class="cmbx-10x-x-109">111</span>, 058701 (2013). <!--l. 80--><p class="indent" > Link to paper: <a href="http://prl.aps.org/abstract/PRL/v111/i5/e058701" class="url" ><span class="cmtt-10x-x-109">http://prl.aps.org/abstract/PRL/v111/i5/e058701</span></a> <!--l. 80--><p class="indent" > V. Nicosia, G. Bianconi, V. Latora, M. Barthelemy, “Non-linear growth and condensation in multiplex networks”, <span class="cmti-10x-x-109">Phys. Rev. E </span><span class="cmbx-10x-x-109">90</span>, 042807 (2014). <!--l. 80--><p class="indent" > Link to paper: <a href="http://journals.aps.org/pre/abstract/10.1103/PhysRevE.90.042807" class="url" ><span class="cmtt-10x-x-109">http://journals.aps.org/pre/abstract/10.1103/PhysRevE.90.042807</span></a> <!--l. 3--><div class="crosslinks"><p class="noindent">[<a href="mammult_docsu34.html" >next</a>] [<a href="mammult_docsu32.html" >prev</a>] [<a href="mammult_docsu32.html#tailmammult_docsu32.html" >prev-tail</a>] [<a href="mammult_docsu33.html" >front</a>] [<a href="mammult_docsu31.html#mammult_docsu33.html" >up</a>] </p></div> <!--l. 3--><p class="indent" > <a id="tailmammult_docsu33.html"></a> </body></html>