# Covers and Nerves¶

## Covers¶

In BATS, a set is a python set, and a cover is a list of sets.

```
cover0 = [ {1,2,3}, {3,4,5}, {5,6,1} ]
```

You can also generate covers from data using landmarks

## Nerves¶

The nerve of a cover is a simplicial complex with a vertex for every set in a cover, and a k-simplex for every non-empty intersection of k+1 sets.

```
from bats import Nerve
N = Nerve(cover0, 2) # second argument is maximum dimension of simplices
```

We can then compute homology:

```
RN = bats.reduce(N, bats.F2()) # second argument is field to use for reduction
# print the betti numbers
for d in range(RN.maxdim() + 1):
print("betti_{}: {}".format(d, RN.hdim(d)))
```

You should see

```
betti_0: 1
betti_1: 1
betti_2: 0
```