# Where do I find data to start a graph data structure to practice on?

I am interested in learning firsthand about graph data structures but have no data to put into the database. Can anyone recommend a source for a beginner to find graph data? (Preferably a source that has nothing to do with Facebook.)

-
add comment

## 3 Answers

When I was in the same position as you, I was very happy to find Knuth's Stanford Graphbase (SGB). He supplies not only a library for working with graphs, but also some data sets to play with. My favorite one was the 5-letter English words dataset. You can use your programming language of choice to generate an undirected graph where two words are neighbors if and only if they differ by exactly one letter. So, for example, "bread" and "broad" are neighbors, but not "bread" and "bleak".

As proposed in the book/documentation (you can buy a printed copy on Amazon, it's quite interesting), you can then play games like "Word Ladders", where players try to find the shortest path between words. Implementing these games will give you an excuse to experiment with shortest-path algorithms, breadth-first searches, etc. Knuth actually provides an implementation of such a game (using his library) in the file ladders.w in the SGB tarball.

There is another data set provided on the SGB webpage: a graph with the adjacencies between the contiguous United States and DC. I cannot include the hyperlink because I'm new to this site.

Note: the library was written using CWEB, a tool for literate programming (again, cannot include link, so google it). If you want to actually use the SGB library, you will need to install CWEB; if you want the documentation, you will need CWEB and TeX.

-
I have taken a data structures course so am somewhat familiar with the basic concepts, like Dijkstra's shortest path,linked-lists,sorting algorithms etc. I'm now looking into the site, although I have to admit I am looking for data more along the lines of bus routes, financial stuff, anonomized consumer data etc. Something a little more exciting where a cool statistic or tendency might emerge. –  JHAWN Dec 11 '12 at 5:21
You should be more precise then about what you want in your question. –  Guilherme Freitas Dec 11 '12 at 10:58
add comment

Try the boost graph library, it's extensively documented and, it is used by CGAL, which is a computational geometry library, which allows for graph visualization (e.g. 2D Segment Delaunay graph or 2D Apollonius Graphs visualisation). If you want to visualize your graphs, CGAL might be a good thing to try. It works with OFF file format, but you can convert it to STL or something else using meshconv.

-
add comment

The data for Algorithms by Sedgewick and Wayne is available at http://introcs.cs.princeton.edu/java/data/.

-
add comment