\hypertarget{diagrams}{}\section{Graphs and diagrams}\label{diagrams}
 Doxygen has built-in support to generate inheritance diagrams for C++ classes.

Doxygen can use the \char`\"{}dot\char`\"{} tool from graphviz 1.5 to generate more advanced diagrams \& graphs. Graphviz is an open-sourced,  cross-platform graph drawing toolkit from AT\&T and Lucent Bell Labs and can be found at \href{http://www.graphviz.org/}{\tt http://www.graphviz.org/}

If you have the \char`\"{}dot\char`\"{} tool available in the path, you can set \hyperlink{config_cfg_have_dot}{HAVE\_\-DOT} to {\tt YES} in the configuration file to  let doxygen use it.

Doxygen uses the \char`\"{}dot\char`\"{} tool to generate the following graphs: \begin{CompactItemize}
\item 
if \hyperlink{config_cfg_graphical_hierarchy}{GRAPHICAL\_\-HIERARCHY} is set to {\tt YES},  a graphical representation of the class hierarchy will be drawn, along  with the textual one. Currently this feature is supported for HTML only.\par
 {\bf Warning:} When you have a very large class hierarchy where many  classes derive from a common base class, the resulting image may become  too big to handle for some browsers. \item 
if \hyperlink{config_cfg_class_graph}{CLASS\_\-GRAPH} is set to {\tt YES}, a graph will be generated for each documented class showing the  direct and indirect inheritance relations. This disables the generation of the built-in class inheritance diagrams. \item 
if \hyperlink{config_cfg_include_graph}{INCLUDE\_\-GRAPH} is set to {\tt YES}, an include  dependency graph is generated for each documented file that includes at  least one other file. This feature is currently supported for HTML and RTF  only. \item 
if \hyperlink{config_cfg_collaboration_graph}{COLLABORATION\_\-GRAPH} is set to YES, a  graph is drawn for each documented class and struct that shows: \begin{CompactItemize}
\item 
 the inheritance relations with base classes. \item 
 the usage relations with other structs \& classes (e.g.  class {\tt A} has a member variable {\tt m\_\-a} of type class {\tt B}, then {\tt A} has an arrow to {\tt B} with {\tt m\_\-a} as label). \end{CompactItemize}
\end{CompactItemize}
The elements in the class diagrams in HTML and RTF  have the following meaning: \begin{CompactItemize}
\item 
 A {\bf yellow} box indicates a class. A box can have a  little marker in the lower right corner to indicate that the class  contains base classes that are hidden.  For the class diagrams the maximum tree width is currently 8 elements.  If a tree is wider some nodes will be hidden. If the box is filled with a  dashed pattern the inheritance relation is virtual. \item 
 A {\bf white} box indicates that the documentation of the class is currently shown. \item 
 A {\bf grey} box indicates an undocumented class. \item 
 A {\bf solid dark blue} arrow indicates public inheritance. \item 
 A {\bf dashed dark green} arrow indicates protected inheritance. \item 
 A {\bf dotted dark green} arrow indicates private inheritance. \end{CompactItemize}
The elements in the class diagram in $\mbox{\LaTeX}$ have the  following meaning: \begin{CompactItemize}
\item 
 A {\bf white} box indicates a class. A {\bf marker} in the lower right corner of the box indicates that the  class has base classes that are hidden.  If the box has a {\bf dashed} border this indicates virtual inheritance. \item 
 A {\bf solid} arrow indicates public inheritance. \item 
 A {\bf dashed} arrow indicates protected inheritance. \item 
 A {\bf dotted} arrow indicates private inheritance. \end{CompactItemize}
The elements in the graphs generated by the dot tool have the following meaning: \begin{CompactItemize}
\item 
 A {\bf white} box indicates a class or struct or file.  \item 
 A box with a {\bf red} border indicates a node that has {\em more} arrows than are shown!  In other words: the graph is {\em truncated} with respect to this node. The reason why a graph is sometimes truncated is to prevent images from becoming too large.  For the graphs generated with dot doxygen tries to limit the width of the resulting image to 1024 pixels.  \item 
 A {\bf black} box indicates that the class' documentation is currently shown. \item 
 A {\bf dark blue} arrow indicates an include relation (for the  include dependency graph) or public inheritance (for the other graphs). \item 
 A {\bf dark green} arrow indicates protected inheritance. \item 
 A {\bf dark red} arrow indicates private inheritance. \item 
 A {\bf purple dashed} arrow indicated a \char`\"{}usage\char`\"{} relation, the  edge of the arrow is labled with the variable(s) responsible for the relation. Class {\tt A} uses class {\tt B}, if class {\tt A} has a member variable {\tt m}  of type C, where B is a subtype of C (e.g. C could be {\tt B}, {\tt B$\ast$}, {\tt T$<$B$>$$\ast$} ).  \end{CompactItemize}
Here are a couple of header files that together show the various diagrams that doxygen can generate:

{\tt diagrams\_\-a.h} 

\footnotesize\begin{verbatim}#ifndef _DIAGRAMS_A_H
#define _DIAGRAMS_A_H
class A { public: A *m_self; };
#endif

\end{verbatim}\normalsize 
 {\tt diagrams\_\-b.h} 

\footnotesize\begin{verbatim}#ifndef _DIAGRAMS_B_H
#define _DIAGRAMS_B_H
class A;
class B { public: A *m_a; };
#endif

\end{verbatim}\normalsize 
 {\tt diagrams\_\-c.h} 

\footnotesize\begin{verbatim}#ifndef _DIAGRAMS_C_H
#define _DIAGRAMS_C_H
#include "diagrams_c.h"
class D;
class C : public A { public: D *m_d; };
#endif

\end{verbatim}\normalsize 
 {\tt diagrams\_\-d.h} 

\footnotesize\begin{verbatim}#ifndef _DIAGRAM_D_H
#define _DIAGRAM_D_H
#include "diagrams_a.h"
#include "diagrams_b.h"
class C;
class D : virtual protected  A, private B { public: C m_c; };
#endif

\end{verbatim}\normalsize 
 {\tt diagrams\_\-e.h} 

\footnotesize\begin{verbatim}#ifndef _DIAGRAM_E_H
#define _DIAGRAM_E_H
#include "diagrams_d.h"
class E : public D {};
#endif

\end{verbatim}\normalsize 






