ConceptLattice: R6 class for a concept lattice

ConceptLatticeR Documentation

R6 class for a concept lattice

Description

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

Super class

fcaR::ConceptSet -> ConceptLattice

Methods

Public methods

Inherited methods

Method new()

Create a new ConceptLattice object.

Usage
ConceptLattice$new(extents, intents, objects, attributes, I = NULL)
Arguments
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

Returns

A new ConceptLattice object.


Method plot()

Plot the concept lattice

Usage
ConceptLattice$plot(object_names = TRUE, to_latex = FALSE, ...)
Arguments
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.

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.

Returns

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.


Method sublattice()

Sublattice

Usage
ConceptLattice$sublattice(...)
Arguments
...

See Details.

Details

As argument, one can provide both integer indices or Concepts, separated by commas. The corresponding concepts are used to generate a sublattice.

Returns

The generated sublattice as a new ConceptLattice object.


Method top()

Top of a Lattice

Usage
ConceptLattice$top()
Returns

The top of the Concept Lattice

Examples
fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$top()


Method bottom()

Bottom of a Lattice

Usage
ConceptLattice$bottom()
Returns

The bottom of the Concept Lattice

Examples
fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$bottom()


Method join_irreducibles()

Join-irreducible Elements

Usage
ConceptLattice$join_irreducibles()
Returns

The join-irreducible elements in the concept lattice.


Method meet_irreducibles()

Meet-irreducible Elements

Usage
ConceptLattice$meet_irreducibles()
Returns

The meet-irreducible elements in the concept lattice.


Method decompose()

Decompose a concept as the supremum of meet-irreducible concepts

Usage
ConceptLattice$decompose(C)
Arguments
C

A list of Concepts

Returns

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


Method supremum()

Supremum of Concepts

Usage
ConceptLattice$supremum(...)
Arguments
...

See Details.

Details

As argument, one can provide both integer indices or Concepts, separated by commas. The corresponding concepts are used to compute their supremum in the lattice.

Returns

The supremum of the list of concepts.


Method infimum()

Infimum of Concepts

Usage
ConceptLattice$infimum(...)
Arguments
...

See Details.

Details

As argument, one can provide both integer indices or Concepts, separated by commas. The corresponding concepts are used to compute their infimum in the lattice.

Returns

The infimum of the list of concepts.


Method subconcepts()

Subconcepts of a Concept

Usage
ConceptLattice$subconcepts(C)
Arguments
C

(numeric or SparseConcept) The concept to which determine all its subconcepts.

Returns

A list with the subconcepts.


Method superconcepts()

Superconcepts of a Concept

Usage
ConceptLattice$superconcepts(C)
Arguments
C

(numeric or SparseConcept) The concept to which determine all its superconcepts.

Returns

A list with the superconcepts.


Method lower_neighbours()

Lower Neighbours of a Concept

Usage
ConceptLattice$lower_neighbours(C)
Arguments
C

(SparseConcept) The concept to which find its lower neighbours

Returns

A list with the lower neighbours of C.


Method upper_neighbours()

Upper Neighbours of a Concept

Usage
ConceptLattice$upper_neighbours(C)
Arguments
C

(SparseConcept) The concept to which find its upper neighbours

Returns

A list with the upper neighbours of C.


Method clone()

The objects of this class are cloneable with this method.

Usage
ConceptLattice$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# 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()


## ------------------------------------------------
## Method `ConceptLattice$top`
## ------------------------------------------------

fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$top()


## ------------------------------------------------
## Method `ConceptLattice$bottom`
## ------------------------------------------------

fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$bottom()


fcaR documentation built on May 29, 2024, 2:05 a.m.