samedi 25 février 2017

I need some help creating an AND system for when a complex network is connected

I currently have an if statement so that two agents i and j are considered to be connected if their beliefs lie within tol of each other. Here is the relevant code for this

for i=1:1:n
   for j=i:1:n
    if abs(beliefs(i) -beliefs(j))< tol
        A(j,i)=1;
        A(i,j)=1;
    end
   end
end

Now I want them to be connected if that condition is true AND they are connected in the complex network, which will be an adjacency matrix produced by a function called random_graph.

Aucun commentaire:

Enregistrer un commentaire