returnBlockEdgeList       package:dynamicGraph       R Documentation

_C_l_a_s_s "_d_g._B_l_o_c_k_E_d_g_e_L_i_s_t": _T_h_e _b_l_o_c_k _e_d_g_e _l_i_s_t

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

     Return a list of block edges, each of class 'dg.BlockEdge'.

     Objects can be created by calls of the form
     'new("dg.BlockEdgeList", ...)'.

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

     returnBlockEdgeList(edge.list, vertices, blocks, 
                         visibleBlocks = 1:length(blocks), width = 2, 
                         color = "default", N = 3, oriented = NA, type = NULL) 

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

edge.list: A list of vectors identifying the edges (between vertices).
          Each vector of 'edge.list' should be a vector of  integers
          giving the indices of the vertices of an edge, or a vector of
          text strings with the names of the vertices. 

vertices: The list of 'vertices',  each of a class containing
          'dg.Vertex'. 

  blocks: The list of 'blocks',  each of a class 'dg.Block'. 

visibleBlocks: A numeric vector with the indices of the
          'visibleBlocks'. The argument is for view where some blocks
          are not visible in the view, but the vertices of the blocks
          are drawn. 

   width: A numeric with the initial 'width' of block edges. 

   color: "default", or list with one or two text strings for colors 
          giving the initial 'color' of block edges. The two colors are
          used for respectively edges between blocks and for edges
          between blocks  and vertices. 

       N: Integer, 'N' is the number of coordinates of the vertices. 

oriented: Logical, if TRUE then the edges are 'oriented'. 

    type: A text string giving the 'type' of block edges. 

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

     A list of block edges, each of class 'dg.BlockEdge'.

_S_l_o_t_s:

     '._D_a_t_a': Object of class '"list"'. 

_E_x_t_e_n_d_s:

     Class '"dg.EdgeList"', directly. Class '"dg.list"', directly.
     Class '"list"', from data part. Class '"dg.NodeList"', by class
     '"dg.EdgeList"'. Class '"vector"', by class '"dg.EdgeList"'. Class
     '"vector"', by class '"dg.list"'. Class '"vector"', by class
     '"list"'.

_M_e_t_h_o_d_s:

     _i_n_i_t_i_a_l_i_z_e 'signature(.Object = "dg.BlockEdgeList")': ... 

     _a_n_c_e_s_t_o_r_s_B_l_o_c_k_L_i_s_t 'signature(blockList = "dg.BlockList")': ... 

     _d_e_s_c_e_n_d_a_n_t_s_B_l_o_c_k_L_i_s_t 'signature(blockList = "dg.BlockList")': ... 

     _c_h_e_c_k_B_l_o_c_k_L_i_s_t 'signature(blockList = "dg.BlockList")': ... 

_N_o_t_e:

     The methods of the edge list, 'returnEdgeList', also applies for
     block edge lists.

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

     Jens Henrik Badsberg

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

     Block.tree <- list(label = "W", Vertices = c("country"),
                        X = list(Vertices = c("sex", "race"),
                                 A = list(Vertices = c("hair", "eye"),
                                          horizontal = FALSE),
                                 B = list(Vertices = c("age"),
                                          C = list(Vertices = c("education")))))
     Names <- unlist(Block.tree)
     Names <- Names[grep("Vertices", names(Names))]
     Types <- rep("Discrete", length(Names))
     vertices <- returnVertexList(Names, types = Types)
     blocktree <- setTreeBlocks(Block.tree, vertices)
     blocks <- blockTreeToList(blocktree$BlockTree)
     from <- c("country", "country", "race", "race",       "sex", "sex")
     to   <- c(    "sex",    "race", "hair",  "eye", "education", "age")
     from <- match(from, Names)
     to <- match(to, Names)
     edge.list <- vector("list", length(to))
     for (j in seq(along = to)) edge.list[[j]] <- c(from[j], to[j])
     edges <- returnEdgeList(edge.list, vertices, color = "red", oriented = TRUE)
     vertices <- blocktree$Vertices
     blockedges <- returnBlockEdgeList(edge.list, vertices, blocks,
                                       color = "red", oriented = TRUE)
     blockedges <- new("dg.BlockEdgeList", edge.list = edge.list, 
                                           vertices = vertices, blocks = blocks,
                                           color = "red", oriented = TRUE)

     Names(blockedges)
     Colors(blockedges)
     Labels(blockedges)
     LabelPositions(blockedges)
     # Positions(blockedges)
     # Strata(blockedges)
     # Indices(blockedges)
     str(NodeTypes(blockedges))
     str(NodeIndices(blockedges))
     Widths(blockedges)
     Oriented(blockedges)
     Widths(blockedges) <- rep(1,  7)
     Widths(blockedges) <- rep(1, 14)
     Widths(blockedges)
     asDataFrame(blockedges)

