C Elegans data and images

I thought it would be a good idea to explain how to obtain the images of C. elegans in the first chapter. The data is taken from the Worm Atlas Project and drawn in Gephi 0.9.2 using the Fruchterman-Reingold layout. 

The data includes a spreadsheet named NeuronConnect.xls, which lists 6418 links between 279 distinct neurons. Once duplicate edges are removed, 2993 distinct directed links remain. Of the 302 neurons in the C. elegans nervous system, 20 are part of the pharyngeal system and are not included, two have no connections, and one connects only to muscle tissue, leaving 279. T

he cited data source does not include data on the pharyngeal system; that data can be obtained from WormWeb. More details can be found in this GitHub repository, including links to the specific input data files used, Jupyter notebooks for processing the data to make it ready to plot, and the Gephi files used to create the plot itself.

The process starts with four input files obtained from two different sources. 

  • The first two files are called NeuronConnect.txt and name_neurons.txt, and they both come from wormweb.org. Links to both files and more information can be found in their details page. The file NeuronConnect.txt contains a list of the connections in the connectome – each line lists two neuron names and a connection type. The file name_neurons.txt has one line for each neuron, listing its name, group and type. 

  • The third file is called synapse_AF.txt, and contains a list of connections within the worm’s pharyngeal system. These connections are typically not included in the connectome, so this file helps to identify them so that they can be removed.

  • The last file is called CElegansNeuronTables-connectome.csv and was obtained from the CElegansNeuroML repository maintained by openworm, which is “An open-source project dedicated to creating a virtual C. elegans nematode in a computer.” The original file there is called CElegansNeuronTables.xls and has been updated since we first downloaded it. The file in the networks repository has been converted from xls (Excel) format to csv (Comma-separated values) to make it easier to read from a Jupyter notebook.

In the Jupyter notebook, we do a fair amount of bookkeeping in order to resolve the actual number of neurons (302) and connections (2290 if we regard the graph as undirected, 2993 if we regard it as directed) in the worm’s non-pharyngeal connectome. We also generate four output files:

  • non-pharyngeal-edges.csv, which lists the edges in the non-pharyngeal system, assuming that the graph is undirected;

  • non-pharyngeal-directed-edges.csv, which lists the edges in the non-pharyngeal system, assuming that the graph is directed;

  • in-degree-dist.csv, which contains the in-degree distribution for the graph assuming that it is directed; and

  • out-degree-dist.csv, which contains the out-degree distribution for the graph assuming that it is directed.

The first two files were used to create the Gephi files c-elegans-undirected.gephi and c-elegans-new-directed.gephi, the second of which was used to create the plot of the connectome graph in the book. The second two files were used to create the plots of the in-degree and out-degree distributions in the book; the actual Jupyter notebook used to generate the plots is also included in the repository.

Although the graph is directed, it is drawn below without arrows. The arrows made the figure look very cluttered.

Here is a picture that did not make it into the book. This is the undirected graph and its degree distribution with degree values on the x-axis and number of vertices with specified degree on the y-axis.



C Elegans on the cover of the book

The cover image was made using a program called neuroConstruct. Download and install the program. The networks repository contains detailed instructions for installing the program (on a Windows PC). In particular, an older version of Java (Java 8) is required to build and run the program.

Obtain the file called CElegans.ncx obtained from the CElegansNeuroML repository and load it into the program to generate a plot.


Rotate the plot to obtain a nice angle. I used this one for the cover. The team at Wiley did their adjustments to make it look as nice as it does.

Some screenshots I did not use are shown below:














First Post

A unique blend of graph theory and network science for mathematicians and data science professionals alike.

Perfect for advanced undergraduates or beginning graduate students in graph theory and network science and for network scientists and data scientists seeking an insightful reference for the mathematics underlying network science.

Contains modern applications for graph theorists and a host of untapped theorems for network scientists.

Available for purchase at Amazon.

Features topics such as minors, connectomes, trees, distance, spectral graph theory, similarity, centrality, small-world networks, scale-free networks, assortative networks, covert networks, graph algorithms, Eulerian circuits, Hamiltonian cycles, coloring, higher connectivity, planar graphs, flows, matchings, and coverings.

The book begins with applications to biology and the social and political sciences and gradually takes a more theoretical direction toward graph structure theory and combinatorial optimization. 

A background in linear algebra, probability, and statistics provides the proper frame of reference.

Graphs and Networks also features:
  • Applications to neuroscience, climate science, and the social and political sciences;

  • A research outlook integrated directly into the narrative with ideas for students interested in pursuing research projects at all levels;

  • A large selection of primary and secondary sources for further reading;

  • Historical notes that hint at the passion and excitement behind the discoveries; and

  • Practice problems that reinforce the concepts and encourage further investigation and independent work.