This class implements the data structure and methods for concept lattices.
fcaR::ConceptSet -> ConceptLattice
new()Create a new ConceptLattice object.
ConceptLattice$new(extents, intents, objects, attributes, I = NULL)plot()Plot the concept lattice
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.
sublattice()Sublattice
top()Top of a Lattice
fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$top()
bottom()Bottom of a Lattice
fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$bottom()
decompose()Decompose a concept as the supremum of meet-irreducible concepts
supremum()Supremum of Concepts
infimum()Infimum of Concepts
# 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()
#> A set of 5 concepts:
#> 1: ({Jupiter, Saturn}, {large, far, moon})
#> 2: ({Uranus, Neptune}, {medium, far, moon})
#> 3: ({Pluto}, {small, far, moon})
#> 4: ({Mercury, Venus}, {small, near, no_moon})
#> 5: ({Earth, Mars}, {small, near, moon})
fc_planets$concepts$meet_irreducibles()
#> A set of 7 concepts:
#> 1: ({Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto}, {moon})
#> 2: ({Jupiter, Saturn, Uranus, Neptune, Pluto}, {far, moon})
#> 3: ({Jupiter, Saturn}, {large, far, moon})
#> 4: ({Uranus, Neptune}, {medium, far, moon})
#> 5: ({Mercury, Venus, Earth, Mars, Pluto}, {small})
#> 6: ({Mercury, Venus, Earth, Mars}, {small, near})
#> 7: ({Mercury, Venus}, {small, near, no_moon})
# Get concept support
fc_planets$concepts$support()
#> [1] 1.0000000 0.7777778 0.5555556 0.2222222 0.2222222 0.5555556 0.3333333
#> [8] 0.1111111 0.4444444 0.2222222 0.2222222 0.0000000
## ------------------------------------------------
## Method `ConceptLattice$top`
## ------------------------------------------------
fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$top()
#> ({Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto}, {})
## ------------------------------------------------
## Method `ConceptLattice$bottom`
## ------------------------------------------------
fc <- FormalContext$new(planets)
fc$find_concepts()
fc$concepts$bottom()
#> ({}, {small, medium, large, near, far, moon, no_moon})