Examples

These and more examples files are included in the examples/ directory of the source repository/distribution.

digits.cxt

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
B

10
7

0
1
2
3
4
5
6
7
8
9
a
b
c
d
e
f
g
X.XXXXX
.....XX
XXX.XX.
XXX..XX
.X.X.XX
XXXX..X
.XXXX.X
X....XX
XXXXXXX
XX.X.XX
from concepts import Context

d = Context.fromfile('examples/digits.cxt')

d.lattice.graphviz(view=True)
_images/digits.svg

relations.csv

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
name,relation,transitive,symmetric,antisymmetric,reflexive,irreflexive,asymmetric,neg. trans.,connected,total,trichotomous
irrefl.,X,,,,,X,,,,,
tolerance,X,,X,,X,,,,,,
equivalence,X,X,X,,X,,,,,,
preorder,X,X,,,X,,,,,,
partial order,X,X,,X,X,,,,,,
total order,X,X,,X,X,,,X,X,X,
strict partial order,X,X,,X,,X,X,,,,
strict weak order,X,X,,X,,X,X,X,,,
strict total order,X,X,,X,,X,X,X,X,,X
R = X = {},X,X,X,X,X,X,X,X,X,X,X
from concepts import Context

r = Context.fromfile('examples/relations.csv', frmat='csv')

r.lattice.graphviz(view=True)
_images/relations.svg

example.json

1
{"context": [[0, 3, 5, 6, 9], [0, 3, 5, 7, 8], [1, 2, 5, 6, 9], [1, 2, 5, 7, 8], [1, 3, 4, 6, 9], [1, 3, 4, 7, 8]], "lattice": [[[], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6], []], [[0], [0, 3, 5, 6, 9], [7, 8, 9], [0]], [[1], [0, 3, 5, 7, 8], [7, 10, 11], [0]], [[2], [1, 2, 5, 6, 9], [8, 12, 13], [0]], [[3], [1, 2, 5, 7, 8], [10, 12, 14], [0]], [[4], [1, 3, 4, 6, 9], [9, 13, 15], [0]], [[5], [1, 3, 4, 7, 8], [11, 14, 15], [0]], [[0, 1], [0, 3, 5], [18, 19], [1, 2]], [[0, 2], [5, 6, 9], [16, 18], [1, 3]], [[0, 4], [3, 6, 9], [16, 19], [1, 5]], [[1, 3], [5, 7, 8], [17, 18], [2, 4]], [[1, 5], [3, 7, 8], [17, 19], [2, 6]], [[2, 3], [1, 2, 5], [18, 20], [3, 4]], [[2, 4], [1, 6, 9], [16, 20], [3, 5]], [[3, 5], [1, 7, 8], [17, 20], [4, 6]], [[4, 5], [1, 3, 4], [19, 20], [5, 6]], [[0, 2, 4], [6, 9], [21], [8, 9, 13]], [[1, 3, 5], [7, 8], [21], [10, 11, 14]], [[0, 1, 2, 3], [5], [21], [7, 8, 10, 12]], [[0, 1, 4, 5], [3], [21], [7, 9, 11, 15]], [[2, 3, 4, 5], [1], [21], [12, 13, 14, 15]], [[0, 1, 2, 3, 4, 5], [], [], [18, 19, 20, 16, 17]]], "objects": ["1sg", "1pl", "2sg", "2pl", "3sg", "3pl"], "properties": ["+1", "-1", "+2", "-2", "+3", "-3", "+sg", "+pl", "-sg", "-pl"]}
from concepts import Context

e = Context.fromjson('examples/example.json', require_lattice=True)

e.lattice.graphviz(view=True)
_images/example.svg