ConceptLattice: R6 class for a context lattice

Description Methods Examples

Description

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

Methods

Public 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 size()

Size of the Lattice

Usage
ConceptLattice$size()
Returns

The number of concepts in the lattice.


Method is_empty()

Is the lattice empty?

Usage
ConceptLattice$is_empty()
Returns

TRUE if the lattice has no concepts.


Method extents()

Concept Extents

Usage
ConceptLattice$extents()
Returns

The extents of all concepts, as a dgCMatrix.


Method intents()

Concept Intents

Usage
ConceptLattice$intents()
Returns

The intents of all concepts, as a dgCMatrix.


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

Print the Concept Lattice

Usage
ConceptLattice$print()
Returns

Nothing, just prints the lattice.


Method to_latex()

Write in LaTeX

Usage
ConceptLattice$to_latex(print = TRUE, ncols = 1, numbered = TRUE, align = TRUE)
Arguments
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?

Returns

The LaTeX code to list all concepts.


Method [()

Get Concepts by Index

Usage
ConceptLattice$[(indices)
Arguments
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.

Returns

A list of SparseConcepts.


Method sublattice()

Sublattice

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

See Details.

Details

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

Returns

The generated sublattice as a new ConceptLattice object.


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 SparseConcepts

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 SparseConcepts, 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 SparseConcepts, 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 support()

Get support of each concept

Usage
ConceptLattice$support()
Returns

A vector with the support of each concept.


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

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

neuroimaginador/fcaR documentation built on Dec. 9, 2020, 5:42 a.m.