## 4 Design of SocialCode
### The Dynamic Forwarding Priority Assignment for Fair Scheduling among Intermediate Nodes  
According to the incentive stimulation guideline proposed in previous subsection, there are two cases that the credit value of the sending intermediate node will decrease. First, if the sending intermediate node delivers a non-innovative piece to the receiving destination one, it must pay its credit value +\(\beta\) to the receiving node. Second, the sending intermediate node must pay its credit value +\(\delta\) to the receiving intermediate one if it delivers a duplicate piece to the receiving one. Hence, if an intermediate node keeps delivering like this and undergoes such the credit loss, it will dissipate its credit values soon. For alleviating this defect, SocialCode must assign dynamic priorities to all nearby intermediate nodes by Equation (4) and propose a fair scheduling method for them to deliver content piece by turns. SocialCode adopts two important parameters of intermediate node \(i\) at time t to decide the forwarding priority, that is, \(pri_{i}^{t}\). They are the number of cached content pieces, that is, the queue length and the current _time-to-live_ (TTL) value of the first content piece stored in its output queue, which are denoted by \(q_{i}^{t}\) and \(ttl_{i}^{t}\), respectively. lease note that \(\omega\) (\(0\leq\omega\leq 1\)) is the factor to give the weight to the queue length, \(q_{max}\) is the maximum number of content pieces that can be stored in the output queue and \(ttl_{max}\) is the initial TTL value of every content piece.  
\[pri_{i}^{t}=\omega\times\frac{q_{i}^{t}}{q_{max}}+(1-\omega)\times\frac{(ttl_ {max}-ttl_{i}^{t})}{ttl_{max}} \tag{4}\]  
As mentioned above, SocialCode should assign a longer backoff delay to the intermediate node than that of each destination node. Hence, the intermediate node could deliver content pieces stored in it after all destination nodes have completed broadcasting their re-encoded NC content pieces, as shown in Figure 1. SocialCode further proposes Equation (5) to assign the backoff delay, that is, \(\Delta t_{int}(i)\), to intermediate node \(i\). For letting the intermediate node broadcast content pieces it received to its neighbors after every destination node does, the first part of \(\Delta t_{int}(i)\), that is, \(\Delta t_{max}+T_{j}\), must be larger than the backoff delay, that is, \(\Delta t_{des}(v)\) in Equation (2), of each destination node \(v\) in \(N(v)\). The second part of \(\Delta t_{int}(i)\), that is, \(\frac{1}{Pri_{i}^{t}}\times\Delta t_{max}\), is inverse proportional to its forwarding priority, that is, \(pri_{i}^{t}\), calculated by Equation (4). Based on Equation (5), SocialCode assigns a smaller backoff time, that is, \(\Delta t_{int}(i)\), to intermediate node \(i\) that has a larger forwarding priority, that is, \(pri_{i}^{t}\). Consequently, the intermediate node with a larger forwarding priority will forward its stored content pieces earlier than other intermediate nodes with smaller priorities do  
\[\begin{split}&\Delta t_{int}(i)=\left(1+\frac{1}{Pri_{i}^{t}} \right)\times\Delta t_{max}+T_{j}\\ &=\left(\Delta t_{max}+T_{j}\right)+\left(\frac{1}{Pri_{i}^{t}} \times\Delta t_{max}\right)\\ &>\Delta t_{des}(v)+\left(\frac{1}{Pri_{i}^{t}}\times\Delta t_{ max}\right)\text{, where }v\in N(v)\end{split} \tag{5}\]