# rlebdm: RLE-Compressed Boolean Dyad Matrix In ergm: Fit, Simulate and Diagnose Exponential-Family Models for Networks

 rlebdm R Documentation

### Description

A simple class representing boolean (logical) square matrix run-length encoded in a column-major order.

### Usage

```rlebdm(x, n)

as.rlebdm(x, ...)

## S3 method for class 'matrix'
as.rlebdm(x, ...)

## S3 method for class 'edgelist'
as.rlebdm(x, ...)

## S3 method for class 'network'
as.rlebdm(x, ...)

## S3 method for class 'rlebdm'
as.matrix(x, ...)

## S3 method for class 'rlebdm'
dim(x)

## S3 method for class 'rlebdm'
print(x, compact = TRUE, ...)

## S3 method for class 'rlebdm'
Ops(e1, e2)

## S3 method for class 'rlebdm'
Math(x, ...)

## S3 method for class 'rlebdm'
compress(x, ...)

## S3 method for class 'rlebdm'
as.edgelist(x, prototype = NULL, ..., output = c("matrix", "tibble"))
```

### Arguments

 `x` for `rlebdm()`, an `rle()` object or a vector that is converted to one; it will be coerced to `logical()` before processing; for `as.rlebdm.matrix()`, a matrix. `n` the dimensions of the square matrix represented. `...` additional arguments, currently unused. `compact` whether to print the matrix compactly (dots and stars) or to print it as a logical matrix. `e1, e2` arguments to the unary (`e1`) or the binary (`e1` and `e2`) operators. `prototype` an optional network with network attributes that are transferred to the edgelist and will filter it (e.g., if the prototype network is given and does not allow self-loops, the edgelist will not have self-loops either,e ven if the dyad matrix has non-`FALSE` diagonal). `output` a string specifying whether the result should be a matrix or a `tibble`.

### Methods (by generic)

• `compress(rlebdm)`: Compress the `rle` data structure in the `rlebdm` by merging successive runs with identical values.

• `as.edgelist(rlebdm)`: Convert an `rlebdm` object to an `edgelist`: a two-column integer matrix or `tibble` giving the cells with `TRUE` values.

### Functions

• `as.rlebdm(matrix)`: Convert a square matrix of mode coercible to `logical` to an `rlebdm`.

• `as.rlebdm(edgelist)`: Convert an object of class `edgelist` to an `rlebdm` object whose cells in the edge list are set to `TRUE` and whose other cells are set to `FALSE`.

• `as.rlebdm(network)`: Convert an object of class `network` to an `rlebdm` object whose cells corresponding to extant edges are set to `TRUE` and whose other cells are set to `FALSE`.

### Note

The arithmetic operators are mathematical functions are implemented for the `Ops` and the `Math` group generics and therefore work for almost all of them automatically. To preserve the integrity of the data structure, the results are cast to logical before return.

`as.rlebdm.ergm_conlist()`

`as.edgelist()`

### Examples

```# From a vector
rlebdm(rep(rep(c(0,1),each=3),14)[seq_len(81)], 9)

# From a constant
rlebdm(1, 3)

# Large matrix (overflowing .Machine\$integer.max)
big <- rlebdm(1, 50000)
unclass(big) # Represented as two runs
stopifnot(length(big)==50000^2)

```

ergm documentation built on Nov. 25, 2022, 1:06 a.m.
{"ft_lang_label":"__label__en","ft_lang_prob":0.66572136,"math_prob":0.85444295,"size":2624,"snap":"2022-40-2023-06","text_gpt3_token_len":753,"char_repetition_ratio":0.16603054,"word_repetition_ratio":0.123786405,"special_character_ratio":0.265625,"punctuation_ratio":0.17938931,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98699933,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-01-29T03:56:39Z\",\"WARC-Record-ID\":\"<urn:uuid:39b6f216-23ff-40f5-bf7d-a32ae2f96676>\",\"Content-Length\":\"49256\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7050e329-4ef2-4125-8534-ac92d68dd569>\",\"WARC-Concurrent-To\":\"<urn:uuid:55bc713e-37fc-493c-aa63-ee07a9c1e559>\",\"WARC-IP-Address\":\"51.81.83.12\",\"WARC-Target-URI\":\"https://rdrr.io/cran/ergm/man/rlebdm.html\",\"WARC-Payload-Digest\":\"sha1:WQ3XI3NBSVKWTQJHWT46PIKMIORGGOZW\",\"WARC-Block-Digest\":\"sha1:DKVOJP6T7DHU7KQ2VXGZBHEZP6FERNLH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499697.75_warc_CC-MAIN-20230129012420-20230129042420-00846.warc.gz\"}"}