Reputation: 131445
I plan on using the DOT graph representation format to persist/serialize graphs with a bunch of attributes - not for the purposes of drawing them.
I got to know about DOT as in input format for GraphViz, so I went to that website to see how DOT gets parsed and whether I could use the parser or easily port it. What I found was this document: Using GraphViz as a Library. Here's what it says about DOT:
The cgraph library provides a parser for graphs represented in DOT. Using this, it is easy to read the graphs and query the desired attributes using agget or agxget . For more information on these functions, see Section 2.1.1.
and in Section 2.1.1 it says:
The first step in drawing a graph is to create it. To use the Graphviz layout software, the graph must be created using the
cgraph
library. We can create a graph in one of two main ways, usingagread()
oragopen()
etc. etc.
... and then it describes those functions, which take a C-standard-library FILE*
, or a char*
string.
I don't quite get it. It looks like cgraph
is just a folder of code within the graphviz repository.
cgraph
exist as a standalone library at all?cgraph
code?Please enlighten me.
Upvotes: 1
Views: 743
Reputation: 7409
Regarding your third question, DOT itself is just a language whose grammar allows one to describe graphs. The various packages applications offer features like an IDE (e.g. GraphViz) and the ability to render and save the graphs in various formats and layouts.
If the grammar of the DOT language allows you to describe your graphs adequately, it's a great way to do that, because of the whole ecosystem of applications and renderers available, should you ever decide to use them. And it is terse -- I use it for system documentation (>400 servers and >1000 nodes) for exactly this reason.
Upvotes: 2
Reputation: 314
A dot file is simply a text file following a structure that desxribes a graph. Historically it was developed alongside GraphViz by AT&T back when "ma-bell" was in charge of the telephone network and developing inventions like the transistor, laser, etc. But dot files can now be read by many graph/network software packages.
cgraph is a library that comes with Graphviz. You can find it by looking for a file named that starts with the name libcgraph and is usually in a folder named lib. It can be used separately from GraphViz. The code for it is in the folder you saw.
technically dot and cgraph are separate things. Indeed Graphviz used to use a different library and switched to the cgraph library some time in the past. So you can find pdfs describing the older graphviz library on the graphviz website.
Think of Graphviz as the IDE/package/visualization system. cgraph is one tool in this package. Dot is the format for a text-based system for storing and manipulating graph data -- especially good for visualization.
Upvotes: 3