I’d like to input my own graphs for use with the Stanford GraphBase CWEB library. I found this example of a graph on the SGB webpage, and understand it for the most part. What I don’t understand is why there are four zero-rows (“”, 0\n) in the vertex list and so many zero-rows (0,0,0) in the edge-list. Graphs seem to compile fine without them, and I don’t see their purpose.
Share
The extra zero-lines are not strictly necessary. They’re included so that when the graph is loaded, memory is preallocated for vertexes and arcs that might be added to the graph later on (for example, in some algorithm being run on the graph). This is as an alternative to dynamically allocating memory for the new vertexes and edges. It just so happens that the graph in that link is supposed to be used in conjunction with an algorithm that needs space for extra nodes and arcs on the graph.