CS 3723
  Programming Languages  
 10  Graphs   


Introduction: For this page's inspiration, see especially the subsection: Implementation [of a graph using adjacency lists and a dictionary], which is a part of: Python Data Structures. You should also read or look over the four subsections before the above-mentioned one. In fact, if I don't do anything more with this page, the chapter above is a good reference.

Earlier in these notes (sections 9.1 Basic Program and 9.2 Using a Class), I implemented the subset algorithm for constructing a DFA from an NFA or from an NFA with ε-moves. Those programs needed graph representations, and for that I used Python lists and tuples. This was a particularly simple approach, and it was completely general as long as one was willing to rename the vertices of the graph. In particular, with that approach the nodes needed to be named as consecutive integers starting with 0. This restriction was only annoying. With that method it was also possible to add vertices and edges dynamically, but other dynamic changes wouldn't work in general.

The programs in sections 9.1 and 9.2 also implemented the ε-closure algorithm, which uses a graph search algorithm (eps_cl( )), either depth-first or breadth-first.


Adjacency Matrix Versus Adjacency List: TBD


JSON Representation: TBD

(Revision date: 2014-06-27. Please use ISO 8601, the International Standard.)