This class implements the data structure and methods for concept lattices.

`new()`

Create a new `ConceptLattice`

object.

ConceptLattice$new(extents, intents, objects, attributes, I = NULL)

`extents`

(

`dgCMatrix`

) The extents of all concepts`intents`

(

`dgCMatrix`

) The intents of all concepts`objects`

(character vector) Names of the objects in the formal context

`attributes`

(character vector) Names of the attributes in the formal context

`I`

(

`dgCMatrix`

) The matrix of the formal context

A new `ConceptLattice`

object.

`size()`

Size of the Lattice

ConceptLattice$size()

The number of concepts in the lattice.

`is_empty()`

Is the lattice empty?

ConceptLattice$is_empty()

`TRUE`

if the lattice has no concepts.

`extents()`

Concept Extents

ConceptLattice$extents()

The extents of all concepts, as a `dgCMatrix`

.

`intents()`

Concept Intents

ConceptLattice$intents()

The intents of all concepts, as a `dgCMatrix`

.

`plot()`

Plot the concept lattice

ConceptLattice$plot(object_names = TRUE, to_latex = FALSE, ...)

`object_names`

(logical) If

`TRUE`

, plot object names, otherwise omit them from the diagram.`to_latex`

(logical) If

`TRUE`

, export the plot as a`tikzpicture`

environment that can be included in a`LaTeX`

file.`...`

Other parameters to be passed to the

`tikzDevice`

that renders the lattice in`LaTeX`

, or for the figure caption. See`Details`

.

Particular parameters that control the size of the `tikz`

output are: `width`

, `height`

(both in inches), and `pointsize`

(in points), that should be set to the font size used in the `documentclass`

header in the `LaTeX`

file where the code is to be inserted.

If a `caption`

is provided, the whole `tikz`

picture will be wrapped by a `figure`

environment and the caption set.

If `to_latex`

is `FALSE`

, it returns nothing, just plots the graph of the concept lattice. Otherwise, this function returns the `LaTeX`

code to reproduce the concept lattice.

`print()`

Print the Concept Lattice

ConceptLattice$print()

Nothing, just prints the lattice.

`to_latex()`

Write in LaTeX

ConceptLattice$to_latex(print = TRUE, ncols = 1, numbered = TRUE, align = TRUE)

`print`

(logical) Print to output?

`ncols`

(integer) Number of columns of the output.

`numbered`

(logical) Number the concepts?

`align`

(logical) Align objects and attributes independently?

The `LaTeX`

code to list all concepts.

`[()`

Get Concepts by Index

ConceptLattice$[(indices)

`indices`

(numeric or logical vector) The indices of the concepts to return as a list of SparseConcepts. It can be a vector of logicals where

`TRUE`

elements are to be retained.

A list of SparseConcepts.

`sublattice()`

Sublattice

ConceptLattice$sublattice(...)

`...`

See Details.

As argument, one can provide both integer indices or `SparseConcepts`

, separated by commas. The corresponding concepts are used to generate a sublattice.

The generated sublattice as a new `ConceptLattice`

object.

`join_irreducibles()`

Join-irreducible Elements

ConceptLattice$join_irreducibles()

The join-irreducible elements in the concept lattice.

`meet_irreducibles()`

Meet-irreducible Elements

ConceptLattice$meet_irreducibles()

The meet-irreducible elements in the concept lattice.

`decompose()`

Decompose a concept as the supremum of meet-irreducible concepts

ConceptLattice$decompose(C)

`C`

A list of

`SparseConcept`

s

A list, each field is the set of meet-irreducible elements whose supremum is the corresponding element in `C`

.

`supremum()`

Supremum of Concepts

ConceptLattice$supremum(...)

`...`

See Details.

As argument, one can provide both integer indices or `SparseConcepts`

, separated by commas. The corresponding concepts are used to compute their supremum in the lattice.

The supremum of the list of concepts.

`infimum()`

Infimum of Concepts

ConceptLattice$infimum(...)

`...`

See Details.

As argument, one can provide both integer indices or `SparseConcepts`

, separated by commas. The corresponding concepts are used to compute their infimum in the lattice.

The infimum of the list of concepts.

`subconcepts()`

Subconcepts of a Concept

ConceptLattice$subconcepts(C)

`C`

(numeric or

`SparseConcept`

) The concept to which determine all its subconcepts.

A list with the subconcepts.

`superconcepts()`

Superconcepts of a Concept

ConceptLattice$superconcepts(C)

`C`

(numeric or

`SparseConcept`

) The concept to which determine all its superconcepts.

A list with the superconcepts.

`lower_neighbours()`

Lower Neighbours of a Concept

ConceptLattice$lower_neighbours(C)

`C`

(

`SparseConcept`

) The concept to which find its lower neighbours

A list with the lower neighbours of `C`

.

`upper_neighbours()`

Upper Neighbours of a Concept

ConceptLattice$upper_neighbours(C)

`C`

(

`SparseConcept`

) The concept to which find its upper neighbours

A list with the upper neighbours of `C`

.

`support()`

Get support of each concept

ConceptLattice$support()

A vector with the support of each concept.

`clone()`

The objects of this class are cloneable with this method.

ConceptLattice$clone(deep = FALSE)

`deep`

Whether to make a deep clone.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# Build a formal context
fc_planets <- FormalContext$new(planets)
# Find the concepts
fc_planets$find_concepts()
# Find join- and meet- irreducible elements
fc_planets$concepts$join_irreducibles()
fc_planets$concepts$meet_irreducibles()
# Get concept support
fc_planets$concepts$support()
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.