R: Visualize Relations

plot {relations} | R Documentation

## Visualize Relations

### Description

Visualize certain crisp endorelations by plotting a Hasse Diagram of their transitive reduction.

### Usage

    ## S3 method for class 'relation'
    plot(x,
         attrs = list(graph = list(rankdir = "BT"),
                      edge = list(arrowsize = NULL),
                      node = list(shape = "rectangle",
                                  fixedsize = FALSE)),
         limit = 6L,
         labels = NULL,
         main = NULL,
         type = c("simplified", "raw"),
         ...)

    ## S3 method for class 'relation_ensemble'
    plot(x,
         attrs = list(list(graph = list(rankdir = "BT"),
                           edge = list(arrowsize = NULL),
                           node = list(shape = "rectangle",
                                       fixedsize = FALSE))),
         type = "simplified",
         limit = 6L,
         labels = NULL,
         ...,
         layout = NULL, main = NULL)

### Arguments

`x` | an R object inheriting from class `relation` or `relation_ensemble`.
`attrs` | argument passed to the plot method for class `graphNEL`. Note that for the `relation_ensemble` method, it is a list of such objects, recycled as needed.
`type` | character vector of either "simplified" or "raw" strings, one for each relation plotted. (See details.)
`limit` | Argument passed to the labeling function creating default labels for the nodes (see `LABELS()`). Recycled as needed for relation ensembles.
`labels` | Optional list of character vectors defining unique labels for the nodes. List of such lists for relation ensembles.
`layout` | integer vector of length 2 specifying the number of rows and columns of the screen layout. If `NULL`, the layout is square.
`...` | Other arguments passed to the `graphNEL` plot method.
`main` | character vector used for the main title(s). If `NULL`, the title(s) is (are) set to the type of the visualized relation(s).

### Details

Visualization requires that package Rgraphviz is available. If type is "simplified" (default), the transitive reduction is first computed to reduce visual complexity (especially for transitive relations). For partial orders, a Hasse diagram is plotted. In case of (acyclic) transitive complete relations (i.e., weak orders, preferences), the dual is plotted. For all other acyclic relations, the asymmetric part is plotted. (Note that the default settings in these cases create a diagram with nodes ordered bottom-up and with no arrows.) For cyclic relations, a raw graph (with arrows) of the corresponding transitive reduction is computed. If type is "raw", a directed graph without any transformation is plotted from the relation.

### See Also

`relation()`, `transitive_reduction()`

### Examples

    require("sets")				# set() etc.
    if(require("Rgraphviz")) {
      ## simple example
      plot(as.relation(1 : 5))

      ## inclusion on a power set:
      ps <- 2 ^ set("a", "b", "c")
      inc <- set_outer(ps, set_is_subset)
      R <- relation(incidence = inc)
      plot(relation_ensemble(R, R), type = c("simplified", "raw"))
    }

[Package relations version 0.6-7 Index]