All relevant data are within the paper and its Supporting Information file.

Introduction {#sec001}
============

People often communicate their daily concerns with others. When an individual's opinion differs from that of others, he is likely to heuristically revise his opinion to adapt to his peer's behavior, with some changes in his confidence \[[@pone.0172982.ref001],[@pone.0172982.ref002]\]. In social behavior, individual opinion interactions depend on various social or psychological factors, such as personality, trust level, reputation, social status, and persuasive abilities \[[@pone.0172982.ref003],[@pone.0172982.ref004]\]. Research has shown that opinion and confidence are related at the outset; when most of an individual's peers have similar opinions, that individual may choose to compromise his opinion \[[@pone.0172982.ref003]\]. However, when those same peers have opinions that are similar to the individual's opinions, it can boost an individual's confidence--even to the level of a related effect known as overconfidence \[[@pone.0172982.ref005], [@pone.0172982.ref006]\]. In the latter context, an individual with strong self-confidence will doubt the accuracy of his own judgment and will be willing to adjust his confidence level to adapt to the collective opinion \[[@pone.0172982.ref007]\]. In such a context, to confirm that a person's opinion is similar to another person's opinion is more important in social behaviors than to express the correctness of the individual opinion \[[@pone.0172982.ref008], [@pone.0172982.ref009]\].

Opinion dynamics theory analyzes how individuals choose conventions, make decisions, schedule tasks, and implement actions \[[@pone.0172982.ref010]\]. At a certain scale of social groups, the rules concerning the local interactions among members may rise to complex behavior based on opinion dynamics, such as consensus, polarization and fragmentation \[[@pone.0172982.ref011]--[@pone.0172982.ref013]\]. In recent years, statistical physics has been widely applied to the social sciences, and an opinion dynamics model with the characteristics of statistical physics has been developed in social opinion research, which can reveal the emergence of collective behavior characteristics in local individual interaction rules. Based on different assessments of the value of opinion, the previous literature mainly focuses on discrete and continuing opinion dynamic models. The discrete models include the Ising spin model \[[@pone.0172982.ref014]\], the voter model \[[@pone.0172982.ref015]\], the majority rule model \[[@pone.0172982.ref016]\], the social impact model \[[@pone.0172982.ref017]\], and the Sznajd model \[[@pone.0172982.ref018]\], whereas the continuing models mainly refer to the Deffuant model \[[@pone.0172982.ref019]\], and the HK model \[[@pone.0172982.ref020]\]. A comprehensive survey of these models can be found in the references \[[@pone.0172982.ref021],[@pone.0172982.ref022]\].

The opinion dynamics model is also helpful in exploring the formation of opinion clusters and reveals the emergence of collective interaction behaviors in networks \[[@pone.0172982.ref023]\]. The previous literature \[[@pone.0172982.ref024]\] analyzes the formation of opinion clusters in adaptive networks, while the related literature \[[@pone.0172982.ref025]\] examines how community structure affects opinion clusters. In the previous literature \[[@pone.0172982.ref026]\], research explores the influence of short-and long-range interactions with individual bias on the overall meaning of opinion clusters.

In the current research on opinion dynamics, individuals are typically assumed to be homogenous and to share the same bounded confidence level, such as the assumptions found in the DW and HK models; however, individuals are different both physiologically and psychologically, and they often have differential reactions in the face of uniform peer opinion. Moreover, individuals may make different decisions with biased confidence levels. Thus, assessing individuals in models as heterogeneous is generally reasonable. A heterogeneous DW model and an HK model were explored in \[[@pone.0172982.ref027]\] as interactive Markov chains and in \[[@pone.0172982.ref028]\] as opinion evolutions that included an agent-based version and a density-based version. Heterogeneous individuals have been segregated based on their confidence levels into informed and uninformed \[[@pone.0172982.ref029]\] or multi-levels \[[@pone.0172982.ref010]\],whereas a heterogeneous model with a time-variant interaction topology was analyzed in \[[@pone.0172982.ref030],[@pone.0172982.ref031]\],and a consensus study was explored in an agent-based model with a time-varying directed graph in \[[@pone.0172982.ref032]\].These opinion dynamics models are becoming increasingly close to real social interaction behaviors, as they incorporate heterogeneous individuals, changeable confidence levels and time-varying interaction topologies.

To survey the characteristics of opinion dynamic behavior in social behaviors, we propose a model with nodes that are related to individual confidence level and an in/out degree of neighbor node. The model is an agent-based and based on a continued opinion dynamics model \[[@pone.0172982.ref019],[@pone.0172982.ref020]\]in which the opinion of an agent can vary smoothly between extremes -- in contrast to discrete opinions, such as binary values, with inherent yes or no responses \[[@pone.0172982.ref015],[@pone.0172982.ref016],[@pone.0172982.ref018]\] -- with a bounded confidence rule that stipulates that agents can interact with one another when the distance of their opinions is close enough to a given confidence level\[[@pone.0172982.ref019],[@pone.0172982.ref020],[@pone.0172982.ref022]\]. In addition, in this model individuals have different initial thresholds of bounded confidence -- which is a critical value of interaction between agents who are willing to exchange opinions -- and a confidence level described by a variable that can change overtime, further an agent can revise his confidence level in his interactions with others, this heterogeneous confidence is called 'confidence variation'. The agent determines his new threshold of bounded confidence based on this confidence variation and the in/out degree of neighbor nodes; his new threshold of bounded confidence will also impact his neighbor's opinions in subsequent interactions. Thus, the threshold of bounded confidence is time-varying. The agent's opinion undergoes a unidirectional change, i.e., the agent will revise his opinion to become closer to his peer's opinion when his threshold of bounded confidence is less than his peer's threshold; however, his peer will remain unaffected unless his peer's own threshold is less than the agent's threshold. The lower confidence level makes the individual insist on his opinion; therefore, his peers' opinions will affect him less \[[@pone.0172982.ref003]\]. In this paper, we investigate the process of opinion evolution and the basic law of opinion formation.

The remainder of this paper is organized as follows. We begin with a definition of our model in Section 2. An analysis of opinion cluster formation and evolution is described in Section 3 and is followed by the experimental design and simulation results in Section 4.A conclusion is presented in the last section.

Methods {#sec002}
=======

The time-varying bounded confidence model {#sec003}
-----------------------------------------

In the Deffuant model \[[@pone.0172982.ref008]\], simple opinion dynamics were proposed for the fully connected graph in which all nodes were interconnected. Here, we apply the idea of neighbors connected by bidirectional or unidirectional links. A directed network G(t) = (V(t),(E(t)), V(t) consists of the nodes set at time t, and E(t) indicates the edges set at time t. In i,j ∈ V(t), node(agent) j is the neighbor of node i only if there is a link from j to i. Therefore $a_{ij}^{t} = 1$, $a_{ij}^{t} \in A^{+}\left( t \right)$ and A^+^(t) is the in-degree adjacent matrix of G(t); otherwise, $a_{ij}^{t} = 0$. Meanwhile $b_{ji}^{t} = 1$, $b_{ji}^{t} \in A^{-}\left( t \right)$, and A^−^(t) is the out-degree adjacent matrix of G(t); otherwise, $b_{ji}^{t} = 0$. The agents in a network have an opinion space that is denoted by X = \[0,1\] for some social issues, and the opinion of Agenti at time t is x~i~(t) ∈ X. The bounded confidence rule for Agentsi and j is ‖x~i~(t) − x~j~(t)‖ ≤ ε~i~(t), and the function of ε~i~(t) is: $$\varepsilon_{i}\left( t \right) = \left( {1 - \delta\left( t \right)} \right)\varepsilon_{i}\left( 0 \right) + \delta\left( t \right)\frac{k_{i}^{+}\left( t - 1 \right)}{k_{i}^{+}\left( {t - 1} \right) + k_{i}^{-}\left( t - 1 \right)}$$

When t = 0, ε~i~(t) = ε~i~(0) and ε~i~(0) is the initial threshold value of bounded confidence -- which is a critical value that indicates how susceptible an agent is to the influence of the opinion of other agents -- each agent has his own value at the beginning, and the confidence level for each agent is a variable in the \[0.0,1.0\]range with an initial value of 1. δ(t) = min{δ(t − 1) + Δδ \* t, 1} is the confidence variation, and Δδ is the confidence variation increment, 0 \< Δδ \< 1. $\frac{k_{i}^{+}\left( t - 1 \right)}{k_{i}^{+}\left( {t - 1} \right) + k_{i}^{-}\left( t - 1 \right)}$ is related by the in/out degree of Agenti and is used to express the influence of neighbors on Agenti\'s opinion, and t \> 0. If the in-degree $k_{i}^{+}\left( {t - 1} \right) = {\sum_{j}\, a_{ij}^{t - 1}}$ is larger than the out-degree $k_{i}^{-}\left( {t - 1} \right) = {\sum_{j}\ b_{ij}^{t - 1}}$, thenthe confidence level of Agenti is relatively high, and the agent's opinion depends much more on his neighbors. By contrast, when $k_{i}^{-}\left( {t - 1} \right)$ is greater than $k_{i}^{+}\left( {t - 1} \right)$, Agenti has a lower confidence level. If $k_{i}^{-}\left( {t - 1} \right)$ and $k_{i}^{+}\left( {t - 1} \right)$ are balanced, Agenti is open, and his confidence is not easily changed; thus the influence of his neighbors is not essential to his opinion. In this instance, the threshold of bounded confidence is time-varying because the agent changes his confidence following exposure to neighbors' opinions.

After each round of opinion interactions, the agent will revise his opinion using certain rules to update his neighbors based on his confidence level, and he will weigh the opinions of his neighbors, on average, against his own opinion at the next interaction \[[@pone.0172982.ref003], [@pone.0172982.ref010],[@pone.0172982.ref020]\]. However, we believe that it is more reasonable to consider an individual as a rational agent who can stick to his opinion at first and is thereafter influenced by his peers, such that the more closed the relationships are, the more influence they have in the evolution of the individual's opinion. The rules of opinion evolution for each agent are provided in formula ([2](#pone.0172982.e015){ref-type="disp-formula"}).The opinion of Agenti at the t time step is $$x_{i}\left( t \right) = x_{i}\left( {t - 1} \right) + \frac{1}{M_{i}^{t - 1}}{\sum_{j \in N_{i}(t - 1)}{a_{ij}^{t - 1}\omega_{ij}\left\lbrack x_{j}\left( {t - 1} \right) - x_{i}\left( {t - 1} \right) \right\rbrack}}$$ where ω~ij~ ∈ W is the weighted relationship between Agentj and Agenti; the weighted spaceis W = \[0,0.5\], which indicates that the opinion of each agent will be affected half as strongly by his neighbors for the most part; and ω~ij~\[x~j~(t − 1) − x~i~(t − 1)\] is the effect strength of neighborAgent j to Agenti. $M_{i}^{t - 1}$ is the number of neighbors for Agenti at the t − 1 time step. At the t time step, Agent i's opinion depends on his own opinion and the average effect strength of his neighbor's opinion at the t-1time step.

Neighbor relationship for opinion formation {#sec004}
-------------------------------------------

The neighbor relationship is important to opinion formation. For example, in a seminar in which participants exchange opinions with one another and reach an agreement, this neighbor relationship is bidirectional. In the case of media information regarding social issues that influences people's opinions, the neighbor relationship is unidirectional. In a political election, different parties have different political opinions, and most of these opinions are in opposition to one another. To explore the influence of the neighbor relationship on opinion formation with time-varying bounded confidence, a definition of the neighbor relationship is given for Agentsi and j in G(t) as follows.

1.  Bidirectional neighbors: For Agenti and Agentj, if ‖x~i~(t) -- x~j~(t)‖ ≤ ε~i~(t) ≤ ε~j~(t) or ‖x~i~(t) -- x~j~(t)‖ ≤ ε~j~(t) ≤ ε~i~(t), Agenti and Agentj are bidirectional neighbors of one another. All bidirectional neighbors are denoted as N~↔~(t) = {i,j ∈ V(t): (i,j) ∈ E(t),(j,i) ∈ E(t)}. All nodes in N~↔~(t) are connected fully and form a strongly connected network.

2.  Unidirectional neighbors: For Agenti and Agentj, if ε~j~(t) ≤ ‖x~i~(t) -- x~j~(t)‖ ≤ ε~i~(t), Agentj is the neighbor of Agenti, but Agenti is not the neighbor of Agentj. All unidirectional neighbors are denoted as N~←~(t) = {i,j ∈ V(t): (i,j) ∈ E(t),(j,i) ∉ E(t)}.

3.  Non-neighbors: For Agenti and Agentj, if ‖x~i~(t) -- x~j~(t)‖ \> ε~i~(t) or ‖x~i~(t) -- x~j~(t)‖ \> ε~j~(t), Agentsi and Agentj are non-neighbors of one another. All the non-neighbors are denoted by N~\<\>~(t) = {i,j ∈ V(t): (i,j) ∉ E(t),(j,i) ∉ E(t)}.

4.  Stable neighbor relationship: At the t time step, Agenti and Agentj are neighbors ofone another whose relationship is defined by one of the above definitions. If at the t + n time step, the relationship between Agenti and Agent j has not changed and continues for any t + n + l time step, and n ≥ 0,l \> 1 then this is a stable neighbor relationship.

As the neighbor relationship plays an important role in opinion evolution, the law of opinion evolution must be further explicated.

Discussion {#sec005}
==========

In the HK model, the number of the final opinion cluster depends on the homogeneous confidence level \[[@pone.0172982.ref020],[@pone.0172982.ref022]\]. However, what are the main factors in our model regarding opinion evolution? What is the influence of the neighbor relationship in opinion formation?

Impacts of neighbor relationship {#sec006}
--------------------------------

When individuals land in a new human social environment, they will most likely communicate with others who have similar characteristics and interests. As exchanges deepen, they form stable relationship networks.

If there is a stable neighbor relationship at the t + n time step, the opinion of Agenti at time t + n + 1 is redefined based on formula ([2](#pone.0172982.e015){ref-type="disp-formula"}) as follows: $$x_{i}\left( {t + n + 1} \right) = x_{i}\left( {t + n} \right) + \frac{1}{M}{\sum_{j \in N}{\omega_{ij}\left\lbrack x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right) \right\rbrack}}$$ where M is the number of neighbors and N is the set of neighbors of Agenti. Because of the stable neighbor relationship, M and N do not change with time.

When opinion evolution occurs at the t + n time step and there is a stable bidirectional neighbor relationship, we use Theorem 1.

***Theorem 1*:** *At the t* + *n time step*, *N*~↔~(*t*) *is set for any Agenti and Agentj who are bidirectional neighbors; then*, *at the t* + *n* + *l time step*, *the difference of their opinion value is* (*1 − Θ*)^*l*^ *times in the t* + *n time step, and* $\Theta = \frac{1}{M}{\sum_{p,q \in N}\omega_{pq}}$*, M represents the agents in N*~*↔*~(*t*).

Based on formula ([3](#pone.0172982.e017){ref-type="disp-formula"}), we deduce the differences in opinion for Agenti and Agent j (who are bidirectional neighbors) as follows: $$\begin{array}{l}
{x_{j}\left( {t + n + 1} \right) - x_{i}\left( {t + n + 1} \right)} \\
{\mspace{108mu} = x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right) + \frac{1}{M}\lbrack{\sum\limits_{q \in N}{\omega_{jq}x_{q}\left( {t + n} \right) - {\sum\limits_{p \in N}{\omega_{ip}x_{p}\left( {t + n} \right)}}\rbrack}}} \\
{\mspace{108mu} - \frac{1}{M}\lbrack{\sum\limits_{q \in N}{\omega_{jq}x_{j}\left( {t + n} \right) - {\sum\limits_{p \in N}{\omega_{ip}x_{i}\left( {t + n} \right)}}\rbrack}}} \\
{\mspace{108mu} = x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \\
{\mspace{108mu} - \frac{1}{M}\left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack\left( \omega_{ji} + \omega_{ij} + {\sum\limits_{p,q \in N - \{{i,j}\}}\omega_{pq}} \right)} \\
{\mspace{108mu} = \left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack\left( {1 - \frac{1}{M}\sum\limits_{p,q \in N}\omega_{pq}} \right)} \\
{\mspace{108mu} = \left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack\left( {1 - \Theta} \right)} \\
\end{array}$$

Additionally, x~j~(t + n + l) − x~i~(t + n + l) = \[x~j~(t + n) − x~i~(t + n)\](1 − Θ)^l^, and ω~ij~ ∈ \[0,0.5\]; therefore, Θ ∈ \[0,0.5\], then ‖x~j~(t + n + l) − x~i~(t + n + l)‖ ≤ ‖x~j~(t + n) − x~i~(t + n)‖ ≤ ε~j~(t + n) or ‖x~j~(t + n + l) − x~i~(t + n + l)‖ ≤ ‖x~j~(t + n) − x~i~(t + n)‖ ≤ ε~i~(t + n). Thus, at the t + n + l time step, Agentsi and j are also bidirectional neighbors, and the difference of their opinion value is (1 − Θ)^l^ times in the t + n time step.

***Definition 1*:** *If neighbor sets of* $N_{\leftrightarrow}^{1}\left( t \right)$ *and* $N_{\leftrightarrow}^{2}\left( t \right)$ *exist in which the agents have bidirectional neighbor relationships, then for all* ${i \in G}_{\leftrightarrow}^{1}\left( t \right)$ *and* ${j \in G}_{\leftrightarrow}^{2}\left( t \right)$*, there is* (*i*,*j*) ∉ *E*(*t*) *and* $\left( j,i \right) \notin E\left( t \right)N_{\leftrightarrow}^{1}\left( t \right)$*, and* $N_{\leftrightarrow}^{2}\left( t \right)$ *have mutual independence, and* $N_{\leftrightarrow}^{1}\left( t \right) \cap N_{\leftrightarrow}^{2}\left( t \right) = \varnothing$.

***Theorem 2*:** *At time t, m sets exist that are stable with mutual independence,* $N_{\leftrightarrow}^{k}\left( t \right) = \left( V^{k}\left( t \right),E^{k}\left( t \right) \right)$*, k = 1,2,...,m. A unidirectional directed network can be described as N*~*←*~(*t*) = {*i* ∈ *V*^1^(*t*), *j* ∈ *V*^*m−*1^(*t*): (*i*,*j*) ∈ *E*(*t*),(*j*,*i*) ∉ *E*(*t*)}, $V^{m - 1}\left( t \right) = {\bigcup_{l = 2}^{m}V^{l}}$. *The evolutionary trend of an opinion cluster formed by the nodes' opinions belongs to V*^*l*^(*t*) *in N*~←~(*t*) *and is related to the overall effect strength of neighbors' opinions S*~*t*~. *If S*~*t*~ \> *0*, *it will move ahead to a higher interval; if S*~*t*~ *\< 0*, *it will move ahead to a lower interval; and if S*~*t*~ *= 0*, *it moves ahead*. *Moreover*, *if there is sufficient time*, *the opinion cluster will converge to consensus*.

Based on the formula ([3](#pone.0172982.e017){ref-type="disp-formula"}), there is: $$\begin{array}{l}
{x_{i}\left( {t + n + 1} \right) - x_{i}\left( {t + n} \right)} \\
{\mspace{108mu} = \frac{1}{M_{N_{\leftarrow}}}\left\lbrack \sum\limits_{j \in N_{\leftarrow}{({t + n})}}a_{ij}^{t + n}\omega_{ij}\left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack \right.} \\
{\mspace{108mu} = \frac{1}{M_{N_{\leftarrow}}}\left\{ \sum\limits_{j \in V^{1}{(t)}}\omega_{ij}\left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack \right.} \\
{\mspace{108mu} + \sum\limits_{j \in V^{2}{(t)}}\omega_{ij}\left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack + \cdots} \\
\left. \mspace{108mu} + \sum\limits_{j \in V^{m}{(t)}}\omega_{ij}\left\lbrack {x_{j}\left( {t + n} \right) - x_{i}\left( {t + n} \right)} \right\rbrack \right\} \\
{\mspace{108mu} = \frac{1}{M_{N_{\leftarrow}}}\sum\limits_{k = 1}^{m}\left\{ \sum\limits_{j \in V^{k}{(t)}}\omega_{ij}\left\lbrack {x_{j}\left( t \right) - x_{i}\left( t \right)} \right\rbrack\left( {1 - \Theta^{k}} \right)^{n} \right\} = \frac{1}{M_{N_{\leftarrow}}}\sum\limits_{k = 1}^{m}S_{i,t}^{k}\left( {1 - \Theta^{k}} \right)^{n}} \\
\end{array}$$ and $\Theta^{k} = \frac{1}{M^{k}}{\sum_{p,q \in V^{k}(t)}\omega_{pq}}$, $S_{i,t}^{k} = {\sum_{j \in V^{k}(t)}{\omega_{ij}\left\lbrack x_{j}\left( t \right) - x_{i}\left( t \right) \right\rbrack}}$.

There is $\Delta X = {\sum_{i \in V^{l}}{\left\lbrack {x_{i}\left( {t + n + l} \right) - x_{i}\left( {t + n} \right)} \right\rbrack =}}\frac{1}{M_{N_{\leftarrow}}}{\sum_{i \in V^{l}}{\sum_{k = 1}^{m}{S_{i,t}^{k}\left( {1 - \Theta^{k}} \right)}^{n}}}$ and $S_{t} = {\sum_{i \in V^{l}}{\sum_{k = 1}^{m}S_{i,t}^{k}}}$ because (1 − Θ^k^) \> 0, and the trend of the opinion cluster consisting of V^1^(t) in N~←~(t) is related to S~t~; lim~n→∞~ X = 0 when n is long enough, and the opinion in N~←~(t) will be the same and a consensus will be reached.

Analysis of Δδ forthe time-varying threshold of bounded confidence {#sec007}
------------------------------------------------------------------

Individuals have different confidence levels and will thus choose to trust some individuals and distrust others; as the trusted persons are grouped together to form a group, they will have similar confidence levels.

For all agents, there is an Agenti whose trust threshold value is ε~i~(t + n) at the t + n time step. Based on formula ([1](#pone.0172982.e007){ref-type="disp-formula"}), we have $$\varepsilon_{i}\left( {t + n} \right) = \left( {1 - \delta\left( {t + n} \right)} \right)\varepsilon_{i}\left( 0 \right) + \delta\left( t + n \right)\frac{k_{i}^{+}\left( t + n - 1 \right)}{k_{i}^{+}\left( {t + n - 1} \right) + k_{i}^{-}\left( t + n - 1 \right)}$$

***Theorem 3***: *At time t*, *a set N*(*t*) *with M nodes and i* ∈ *N*(*t*) *exists*, *and the confidence variation increment of Agenti is 0* \< Δ*δ* ≤ 1; *at time t + n*, *Agenti and his neighbor have a stable neighbor relationship*. *The in and out degrees are k*^*+*^ *and k*^*−*^ *for all nodes in set N*(*t*)*, such that* $K = \frac{k^{+}}{k^{+} + k^{-}}$*. When K \< ε*~*i*~(0), *the time-varying threshold of bounded confidence for Agenti is decreased progressively at* δΔε~i~. *When K \> ε*~*i*~(0), *the time-varying threshold is increased progressively at* δΔε~i~. *When K = ε*~*i*~(0), *the time-varying threshold does not change overtime*. *Thus*, *at this juncture*, Δε~i~ *= K − ε*~*i*~(0)*. When* $K = \frac{1}{M}{\sum_{i}{\varepsilon_{i}\left( 0 \right)}}$*, the time-varying bounded confidence converges to consensus.*

For any agent at the t + n + 1 time step, we can infer as follows based on formula ([4](#pone.0172982.e034){ref-type="disp-formula"}): $$\begin{array}{l}
{\left\lbrack \varepsilon \right._{i}\left( {t + n + 1} \right) - \varepsilon_{i}\left( {t + n} \right)\rbrack} \\
{\mspace{104mu} = \left\lbrack {\delta\left( {t + n} \right) - \delta\left( {t + n + 1} \right)} \right\rbrack\varepsilon_{i}\left( 0 \right) + \delta\left( {t + n + 1} \right)K - \delta\left( {t + n} \right)K} \\
{\mspace{104mu} = \Delta\delta\left\lbrack K - \varepsilon_{i}\left( 0 \right) \right\rbrack} \\
\end{array}$$

If 0 \< Δ*δ* ≤ 1, the change trend of \[ε~i~(t + n + 1) − ε~i~(t + n)\] depends on Δ*ε*~*i*~. Additionally, the total difference of time-varying bounded confidence is $$\begin{matrix}
{{\sum\limits_{i}{\left\lbrack \varepsilon \right._{i}\left( {t + n + 1} \right) - \varepsilon_{i}\left( {t + n} \right)\rbrack}} = - \Delta\delta{\sum\limits_{i}\left\lbrack {\varepsilon_{i}\left( 0 \right) - K_{i}\left( {t + n} \right)} \right\rbrack}} \\
{= - \Delta\delta\left\lbrack {\sum\limits_{i}{\varepsilon_{i}\left( 0 \right)}} - MK \right\rbrack} \\
\end{matrix}$$

Therefore, if $K = \frac{1}{M}{\sum_{i}{\varepsilon_{i}\left( 0 \right)}}$, the time-varying bounded confidence converges.

Results {#sec008}
=======

Experimental hypotheses on the initial conditions are provided to better investigate the dynamic behavior of an opinion cluster in simulation and instanceanalysis.

Experimental hypothesis {#sec009}
-----------------------

1.  There are200 agents in total, and each is coded for identification purposes from 1 to 200.

2.  An agent's opinion and his thresholds of bounded confidence obey a uniform distribution of \[0,1.0\], where the weight factor ω satisfies the uniform distribution of \[0, 0.5\].

3.  There is no isolated node in the network, and all agents are willing to exchange opinions.

4.  The confidence variation increment is given by the four conditions (Δδ = 0, Δδ = 0.005, Δδ = 0.01, Δδ = 0.9), that are described as Conditions I-IV in the following sections.

5.  An opinion evolution period is called a time step in each experiment.

Next, we will reveal how opinion clusters are formed with experimental methods.

Experiment result {#sec010}
-----------------

Opinion evolution is simulated in SWARM programming \[[@pone.0172982.ref033]\]. [Fig 1](#pone.0172982.g001){ref-type="fig"} shows the evolution of opinions, and the confidence variation plays a prominent role under the four conditions, which is shown in the figures.

![Opinion evolution with different values of Δδ.\
(**a**) Δδ = 0; (**b**) Δδ = 0.005; (**c**) Δδ = 0.01; (**d**) Δδ = 0,9. The lines with different color denote the opinions of agents varying from 0.0 to 1.0.](pone.0172982.g001){#pone.0172982.g001}

[Fig 1](#pone.0172982.g001){ref-type="fig"} shows the opinion evolution over 1,000 time steps in Conditions I-IV. The times differ for opinion cluster formation, and the interval distribution of the largest opinion cluster changes from high to low due to different confidence variations. Condition IV changes dramatically.

The largest opinion clusters in the four conditions change downwards under the influence ofthe effect strength of neighbors' opinions. To investigate the influence of the neighbor relationship on the agent's opinion, we choose Agent117(the agent identified as 117), who has been observed in the biggest opinion cluster in Conditions I-IV in the experiments.

We analyze the effect strength of his neighbors' opinions in Conditions I-IV, which is shown in [Fig 2A](#pone.0172982.g002){ref-type="fig"}; all the lines in the figure first increase sharply, then decrease to less than zero, and finally increase slowly until they are steady at zero. The special situation is studied in [Fig 2B](#pone.0172982.g002){ref-type="fig"} for Condition III, where the neighbor relationship of Agent 117 is steady at the seventh time step, which is known from his in-degree and out-degree adjacent matrixes. However, at the 16th time step, his opinion changes to the max value, meeting in the average neighbor opinion value, and the effect strength of his neighbors' opinions is more than zero at this time step. Then, his opinion decreases gradually along with his neighbors' opinions effect strength to less than zero and converges over 10,000 time steps.

![The opinion evolution of agent117.\
(a) The average effect strength of the opinions of Agent117's neighbors. The black, green, blue, and red lines denote the confidence variations with Δδ = 0, Δδ = 0.005, Δδ = 0.01, and Δδ = 0.9, respectively. (b) Opinion evolution of Agent117 with Δδ = 0.01. The line with cross marks denotes the opinion of Agent117, and the line with circle marks denotes the average opinions of Agent117's neighbors. The cross point of the horizontal and the vertical dotted lines indicate the max value of opinions for Agent117 and his neighbors. The embedded figure shows the opinion evolution of Agent117 in 10000 time steps.](pone.0172982.g002){#pone.0172982.g002}

We find that there are different neighbor relationship sets in-degree and out-degree adjacent matrixes, such as bidirectional neighbors sets $N_{i\leftrightarrow j}^{7} = \left\{ 19,46,72,103,140,191,196 \right\}$, $N_{i\leftrightarrow j}^{7} = \left\{ 29,42,109,144 \right\}$, $N_{i\leftrightarrow j}^{1} = \left\{ 35 \right\}$, and $N_{i\leftrightarrow j}^{186} = V - N_{i\leftrightarrow j}^{7} - N_{i\leftrightarrow j}^{4} - N_{i\leftrightarrow j}^{1} - N_{i\leftrightarrow j}^{6}$; the non-neighbors set $N_{i\leftrightarrow j}^{6} = \left\{ 6 \right\}$; and one unidirectional neighbors set $N_{i\leftrightarrow j}^{186 +} = \left\{ j \in N_{i\leftrightarrow j}^{7} \cup N_{i\leftrightarrow j}^{4} \cup N_{i\leftrightarrow j}^{1},\ i \in N_{i\leftrightarrow j}^{186}:\left( i,j \right) \in E,\left( j,i \right) \notin E \right\}$; The sign V represents the set of all nodes, the superscript of the set N is the label (which is referred to here as the number of nodes), and the subscript is the relationship between agents. The numbers in sets serve to identify the agents. And we have got the sum of effect strength of opinions of agent 117's neighbours in 1000 time steps from the data source as follows, and please see data file \[[S1 Dataset](#pone.0172982.s001){ref-type="supplementary-material"}\] for the specific calculation: $$S_{1000} = S_{117,1000}^{7} + S_{117,1000}^{4} + S_{117,1000}^{1} + S_{117,1000}^{186} = - 0.001036445$$

The opinion values of agents in set $N_{i\leftrightarrow j}^{186}$ change less because their neighbors with small opinion values have a greater effect regarding the strength of their opinions, such that the largest opinion cluster changes downwards.

Based on Theorem 2, we confirm that a group of random data must exist regarding opinions as well as a threshold and weight factor for those agents that make the opinion cluster move ahead to a higher level. Therefore, we simulate them in SWARM, and the results are as follows.

[Fig 3](#pone.0172982.g003){ref-type="fig"} shows that the largest opinion cluster moves ahead to a higher level with the influence of neighbor effect strength on other random data for the opinion of agents.

![Opinion and confidence evolution with Δδ = 0.01.\
(a) Opinion Evolution. (b) Confidence Evolution. Lines with different colors denote the opinions and thresholds of bounded confidence.](pone.0172982.g003){#pone.0172982.g003}

[Fig 4](#pone.0172982.g004){ref-type="fig"} displays the changes in the threshold of bounded confidence in Conditions I-IV, In Conditions II-IV, the confidence level converges in different groups, and the convergent value is the average value of the group, i.e., when they have the same threshold of bounded confidence, they have a stable relationship and are in the same group, which is consistent with the results and theoretical analysis embodied in Theorem 3.

![The threshold bounds of confidence with different values of Δδ.\
(**a**) Δδ = 0; (**b**) Δδ = 0.005; (**c**) Δδ = 0.01; (**d**) Δδ = 0.9. The lines with different colors denote the confidence level of agents varying from 0.0 to 1.0.](pone.0172982.g004){#pone.0172982.g004}

[Fig 4](#pone.0172982.g004){ref-type="fig"} presents the thresholds of bounded confidence changes in the four conditions; in Condition IV, the best cluster of the trust threshold value is larger than the others.

When the confidence variation is larger, we find that the largest opinion cluster moves faster from high to low and the number of opinion clusters decreases.

***Definition2***: *For all agents in a group who change their opinion*, *the ultimate opinion values are called a group consensus opinion.*

To analyze how a group consensus opinion forms and the number of consensus opinions in a group, we demonstrate convergence over time in [Fig 5](#pone.0172982.g005){ref-type="fig"}.

![The analysis of consensus opinions with different values of Δδ.\
(a) The formation process of a consensus opinion; the embedded figure shows the number of opinions changing in 400 time steps. (b) The sample variance of opinions. The black, green, blue, and red lines denote Δδ = 0, Δδ = 0.005, Δδ = 0.01 and Δδ = 0.9, respectively.](pone.0172982.g005){#pone.0172982.g005}

The process of convergence is shown in 5,000 time steps and at the beginning of convergence. Those agents with similar opinions in the group begin to share the same opinions as their neighbors; the number of opinions are 14,5,5, and 2 in the four conditions at 5000 time step. However, in Condition I, the number 14 will be decreased in theory over longer time steps, and it is more difficult to converge to the consensus opinion in Condition I than in the other conditions. The confidence variation is the main reason to accelerate convergence, and when the confidence variation is larger, convergence is more rapid. However, there are certain phenomena that are not initially clear between Conditions II and III. In Condition II, it converges a little faster and earlier than is the case in Condition III. We explain this phenomenon in [Fig 5B](#pone.0172982.g005){ref-type="fig"}, the opinion sample variance, where the degree of sample variance in the Condition II is shown to be lower than in Condition III; we infer that this sample variance is the primary reason for the different convergences in Condition II.

A special case analysis of Δδ = 1 {#sec011}
---------------------------------

Δδ = 1 is a special case because it only concernsthe network structure. For $\varepsilon_{i}\left( t \right) = \frac{k_{i}^{+}\left( t - 1 \right)}{k_{i}^{+}\left( t - 1 \right) + k_{i}^{-}\left( t - 1 \right)}$, the in/out degree of the real network is crucial for an agent's opinion. Ifwe suppose that the in and out degrees are 1, then we have the following experimental results.

[Fig 6A and 6B](#pone.0172982.g006){ref-type="fig"} show the opinion evolution and confidence level overtime. The trust threshold value is always 0.5,all agents are neighbors at the outset, and opinion clusters and the group consensus opinion both converge to 0.5, as shown in [Fig 6C](#pone.0172982.g006){ref-type="fig"}. Theorem 3 shows that if $\frac{k_{i}^{+}\left( t - 1 \right)}{k_{i}^{+}\left( t - 1 \right) + k_{i}^{-}\left( t - 1 \right)} = \varepsilon_{i}\left( 0 \right)$, it will converge to the consensus opinion. Because *ε*~*i*~(0) = 0.5 at the beginning, then $\frac{k_{i}^{+}\left( t - 1 \right)}{k_{i}^{+}\left( t - 1 \right) + k_{i}^{-}\left( t - 1 \right)} = 0.5$, and the network is connected completely which is also known form the adjacent matrixes. [Fig 6D](#pone.0172982.g006){ref-type="fig"} shows the influence of $\frac{k_{i}^{+}\left( t - 1 \right)}{k_{i}^{+}\left( t - 1 \right) + k_{i}^{-}\left( t - 1 \right)}$; when there are more increments for Δδ, the agent's opinion has greater influence.

![Analysis for Δδ = 1.\
(a)Opinion evolution. (b) Confidence evolution. (c) An area figure showing the interval distribution of opinion evolution overtime. The areas with different colors denote the opinion interval overtime. (d) The average degree impact of neighbors. The green, blue, red, and orange lines denote the impact of Δδ = 0.005, Δδ = 0.01, Δδ = 0.9, and Δδ = 1, respectively.](pone.0172982.g006){#pone.0172982.g006}

The real network structure plays an important role in opinion evolution, although this structure will be explored in another paper.

Conclusion {#sec012}
==========

We advance an opinion formation model with time-varying bounded confidence that is based on how people communicate in daily life; the model involves confidence variation and the degree of neighbor node. We provided the mathematical definition of the model and figures regarding opinion evolution and time-varying bounded confidence that were obtained under experimental conditions. We explored the evolutionary trend of opinion clusters by defining the neighbor relationship, and we found that opinions in groups converged exponentially into a stable neighbor relationship. The evolutionary trend of opinion clusters relates to the average opinion strength of the neighbor. If the average opinion strength is greater than zero, the opinion cluster will transform to a high interval. If the average opinion strength is less than zero, the opinion cluster will transform to a low interval. If the strength of the opinion equals zero, then neighbors share the same opinions, i.e., group consensus opinions. Moreover, the confidence variation increment is the main factor in shortening the convergence time. We explored time-varying bounded confidence using 0 \< Δ*δ* ≤ 1, and found that the threshold of bounded confidence converges at a rate to consensus; meanwhile, $K = \frac{1}{M}{\sum_{i}{\varepsilon_{i}\left( 0 \right)}}$. Δδ = 1 is a special condition involving the real network structure. Our work is preliminary, and more in-depth research will be conducted in the future.

Confidence variation will affect the number of opinion clusters, the convergence of the trust threshold value and the degree of the opinion sample dispersion. When Δδ is larger, the stable neighbor relationships will form faster, and the effect on opinion evolution will be greater.

Opinion clusters are also related to the characteristics of individuals. Agents with a high opinion value but a low trust threshold value find it difficult to incorporate their opinion cluster into other groups, even when the confidence variation increment is sufficiently large. Notably, the role of individual characteristics in consensus will be discussed in future work.

Supporting information {#sec013}
======================

###### Dataset for time-varying opinion formation.

Dataset for Opinions and Confidence with Δδ = 0; Δδ = 0.0005; Δδ = 0.01; and Δδ = 0.9; and dataset of the instance of Agent117.

(XLSX)

###### 

Click here for additional data file.

We are grateful to ZhenLin Wang for his inspiring feedbacks and participation in the work, and we thank two anonymous reviewers for their constructive comments. The authors thank Kimberly Yasutis and her team members for language editing and figure formatting.

[^1]: **Competing Interests:**The authors have declared that no competing interests exist.

[^2]: **Conceptualization:** YZ QL.**Formal analysis:** YZ QL.**Software:** YZ.**Writing -- original draft:** YZ QL.**Writing -- review & editing:** YZ QL SZ.
