Skip to main content
. 2024 Feb 8;10:e1854. doi: 10.7717/peerj-cs.1854

Algorithm 2. Closeness_aware heuristic algorithm.

1: Set of requested content Cr
2: Set of network cachers Nc
3: NnCount(Nc)
4: NrCount(Cr)
5: for all j to Nr do
6:  for all i to Nn do
7:   Compute CT[Nc[i],Cr[j]]eq(4)Eq. (4)
8:   insert ( Nc[i],C[Nc[i],C_r[j]] ) into the closeness metric named as List[j].
9:  end for
10: end for
11: for all j to Nr do
12:  for all i to Nn do
13:   sort List[i] in ascending order using the insertion sort algorithm.
14:  end for
15: end for
16: for all j to Nr do
17:  for all i to Nn do
18:   if First item in List[j] = =Nn[i] then
19:    insert [ Nc[i],Cr[j],CT[Nn[i],Cr[j]] into the Popular cacher List (PL)
20:   end if
21:  end for
22: end for
23: Repeat
24: for all j to Nn do
25:  if First item in PL[j] == Nc[j] then
26:   insert Nc[j] into (CIB) table cacher field.
27:   remove content Cr[j] from PL List
28:  end if
29: end for
30: until PL[j] =! 0
31: Repeat
32: sending name-prefix with their corresponding cacher name to the content producer.
33: until (Nr!==0)