function a = gets_infected(E,I_idx,I,beta,dt,K,fun)
% returns boolean a, equal to 1 if the implicit vertex gets infected by its infectious nghbs in
% intersect(e,I_id), equal to 0 otherwize
a=0;
e = length(E);
infection_rate = 0;
for h=1:e
    h_nodes=find(I(:,E(h))==1);
    k=length(h_nodes);
    V=intersect(h_nodes,I_idx);
    infection_rate = infection_rate + f(length(V),k,K,fun);
end
if rand(1)<1-exp(-beta*infection_rate*dt)
            a = 1;
end
end