We present a scheme for learning a cognitive map of a maze from a sequence of views and movement decisions. The scheme is based on an intermediate representation called the view graph. We show that this representation carries sufficient information to reconstruct the topological and directional structure of the maze. Moreover, we present a neural network that learns the view graph during a random
exploration of the maze. We use a unsupervised competitive learning rule which translates temporal sequence (rather than similarity) of views into connectedness in the network. The network uses its knowledge of the topological and directional structure of the maze to generate expectations about which views are likely to be perceived
next, improving the view recognition performance. We provide an additional mechanism which uses the map to find paths between arbitrary points of the previously explored environment. The results are compared to findings of behavioural neuroscience.