graph.knn               package:igraph               R Documentation

_A_v_e_r_a_g_e _n_e_a_r_e_s_t _n_e_i_g_h_b_o_r _d_e_g_r_e_e

_D_e_s_c_r_i_p_t_i_o_n:

     Calculate the average nearest neighbor degree of the given
     vertices and the same quantity in the function of vertex degree

_U_s_a_g_e:

     graph.knn(graph, vids=V(graph), weights=NULL)

_A_r_g_u_m_e_n_t_s:

   graph: The input graph. It can be directed, but it will be treated
          as undirected, i.e. the direction of the edges is ignored.

    vids: The vertices for which the calculation is performed. Normally
          it includes all vertices. Note, that if not all vertices are
          given here, then both ''knn'' and ''knnk'' will be calculated
          based on the given vertices only.

 weights: Weight vector. If the graph has a 'weight' edge attribute,
          then this is used by default. If this argument is given, then
          vertex strength (see 'graph.strength') is used instead of
          vertex degree. But note that 'knnk' is still given in the
          function of the normal vertex degree. 

_D_e_t_a_i_l_s:

     Note that for zero degree vertices the answer in ''knn'' is 'NaN'
     (zero divided by zero), the same is true for ''knnk'' if a given
     degree never appears in the network.

_V_a_l_u_e:

     A list with two members: 

     knn: A numeric vector giving the average nearest neighbor degree
          for all vertices in 'vids'.

    knnk: A numeric vector, its length is the maximum (total) vertex
          degree in the graph. The first element is the average nearest
          neighbor degree of vertices with degree one, etc. 

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_R_e_f_e_r_e_n_c_e_s:

     Alain Barrat, Marc Barthelemy, Romualdo Pastor-Satorras,
     Alessandro Vespignani: The architecture of complex weighted
     networks, Proc. Natl. Acad. Sci. USA 101, 3747 (2004)

_E_x_a_m_p_l_e_s:

     # Some trivial ones
     g <- graph.ring(10)
     graph.knn(g)
     g2 <- graph.star(10)
     graph.knn(g2)

     # A scale-free one, try to plot 'knnk'
     g3 <- simplify(ba.game(1000, m=5))
     graph.knn(g3)

     # A random graph
     g4 <- random.graph.game(1000, p=5/1000)
     graph.knn(g4)

     # A weighted graph
     g5 <- graph.star(10)
     E(g5)$weight <- seq(ecount(g5))
     graph.knn(g5)

