The nervous system of the nematode C. elegans provides a unique opportunity to understand how behavior ('mind') emerges from activity in the nervous system ('brain') of an organism. The hermaphrodite worm has only 302 neurons, all of whose connections (synaptic and gap junctional) are known. Recently, many of the functional circuits that make up its behavioral repertoire have begun to be identified. In this paper, we investigate the hierarchical structure of the nervous system through k-core decomposition and find it to be intimately related to the set of all known functional circuits. Our analysis also suggests a vital role for the lateral ganglion in processing information, providing an essential connection between the sensory and motor components of the C. elegans nervous system.