con.comp                 package:fpc                 R Documentation

_C_o_n_n_e_c_t_i_v_i_t_y _c_o_m_p_o_n_e_n_t_s _o_f _a_n _u_n_d_i_r_e_c_t_e_d _g_r_a_p_h

_D_e_s_c_r_i_p_t_i_o_n:

     Computes the connectivity components of an undirected graph from a
     matrix giving the edges.

_U_s_a_g_e:

     con.comp(comat)

_A_r_g_u_m_e_n_t_s:

   comat: a symmetric logical or 0-1 matrix, where 'comat[i,j]=TRUE'
          means that there is an edge between vertices 'i' and 'j'. The
          diagonal is ignored.

_D_e_t_a_i_l_s:

     The "depth-first search" algorithm of Cormen, Leiserson and Rivest
     (1990, p. 477) is used.

_V_a_l_u_e:

     An integer vector, giving the number of the connectivity component
     for each vertice.

_A_u_t_h_o_r(_s):

     Christian Hennig chrish@stats.ucl.ac.uk <URL:
     http://www.homepages.ucl.ac.uk/~ucakche/>

_R_e_f_e_r_e_n_c_e_s:

     Cormen, T. H., Leiserson, C. E. and Rivest, R. L. (1990),
     _Introduction to Algorithms_, Cambridge: MIT Press.

_S_e_e _A_l_s_o:

     'hclust', 'cutree' for cutted single linkage trees (often
     equivalent).

_E_x_a_m_p_l_e_s:

       set.seed(1000)
       x <- rnorm(20)
       m <- matrix(0,nrow=20,ncol=20)
       for(i in 1:20)
         for(j in 1:20)
           m[i,j] <- abs(x[i]-x[j])
       d <- m<0.2
       cc <- con.comp(d)
       max(cc) # number of connectivity components
       plot(x,cc)
       # The same should be produced by
       # cutree(hclust(as.dist(m),method="single"),h=0.2).

