/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/circogen/circular.h

Go to the documentation of this file.
00001 /* $Id: circular.h,v 1.1.1.1 2004/12/23 04:04:30 ellson Exp $ $Revision: 1.1.1.1 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 #ifndef CIRCULAR_H
00018 #define CIRCULAR_H
00019 
00020 #include <render.h>
00021 #include <block.h>
00022 #include <stack.h>
00023 
00024 typedef struct {
00025     blocklist_t bl;
00026     int orderCount;
00027     int blockCount;
00028     nstack_t *bcstack;
00029     attrsym_t *N_artpos;
00030     attrsym_t *N_root;
00031     char *rootname;
00032     double min_dist;
00033 } circ_state;
00034 
00035 typedef struct {
00036     Agnode_t *dnode;
00037 } ndata;
00038 
00039 /* Extra node data used for layout:
00040  * Pass O: build derived graph
00041  * Pass 1: construct blocks
00042  * Pass 2: construct block tree
00043  * Pass 3: layout block
00044  *      a:  construct block skeleton
00045  *      b:  construct skeleton spanning tree
00046  *      c:  construct circular list of nodes
00047  * Pass 4: connect blocks
00048  */
00049 typedef struct {
00050     union {                     /* Pointer to node/cluster in original graph */
00051         Agraph_t *g;
00052         Agnode_t *np;
00053     } orig;
00054     int flags;
00055     node_t *parent;             /* parent in block-cutpoint traversal (1,2,4) */
00056     block_t *block;             /* Block containing node (1,2,3,4) */
00057     union {
00058         struct {                /* Pass  1 */
00059             node_t *next;       /* used for stack */
00060             int val;
00061             int low_val;
00062         } bc;
00063         node_t *clone;          /* Cloned node (3a) */
00064         struct {                /* Spanning tree and longest path (3b) */
00065             node_t *tparent;    /* Parent in tree */
00066             node_t *first;      /* Leaf on longest path from node */
00067             node_t *second;     /* Leaf on 2nd longest path from node */
00068             int fdist;          /* Length of longest path from node */
00069             int sdist;          /* Length of 2nd longest path from node */
00070         } t;
00071         struct {
00072             int pos;            /* Index of node in block circle (3c,4) */
00073             double psi;         /* Offset angle of children (4) */
00074         } f;
00075     } u;
00076 } cdata;
00077 
00078 typedef struct {
00079     int order;
00080 } edata;
00081 
00082 #define NDATA(n) ((ndata*)((n)->u.alg))
00083 #define DNODE(n)        (NDATA(n)->dnode)
00084 
00085 #define EDGEDATA(e)  ((edata*)((e)->u.alg))
00086 #define EDGEORDER(e) (EDGEDATA(e)->order)
00087 
00088 #define DATA(n) ((cdata*)((n)->u.alg))
00089 #define ORIGG(n)        (DATA(n)->orig.g)
00090 #define ORIGN(n)        (DATA(n)->orig.np)
00091 #define FLAGS(n) (DATA(n)->flags)
00092 #define PARENT(n) (DATA(n)->parent)
00093 #define BLOCK(n) (DATA(n)->block)
00094 #define NEXT(n) (DATA(n)->u.bc.next)
00095 #define VAL(n) (DATA(n)->u.bc.val)
00096 #define LOWVAL(n)        (DATA(n)->u.bc.low_val)
00097 #define CLONE(n) (DATA(n)->u.clone)
00098 #define TPARENT(n)      (DATA(n)->u.t.tparent)
00099 #define LEAFONE(n)      (DATA(n)->u.t.first)
00100 #define LEAFTWO(n)      (DATA(n)->u.t.second)
00101 #define DISTONE(n)      (DATA(n)->u.t.fdist)
00102 #define DISTTWO(n)      (DATA(n)->u.t.sdist)
00103 #define POSITION(n) (DATA(n)->u.f.pos)
00104 #define PSI(n) (DATA(n)->u.f.psi)
00105 
00106 #define VISITED_F   (1 << 0)
00107 #define BCDONE_F    (1 << 1)
00108 #define ONSTACK_F   (1 << 2)
00109 #define PARENT_F    (1 << 3)
00110 #define PATH_F      (1 << 4)
00111 #define NEIGHBOR_F  (1 << 5)
00112 
00113 #define VISITED(n) (FLAGS(n)&VISITED_F)
00114 #define BCDONE(n)        (FLAGS(n)&BCDONE_F)
00115 #define ONSTACK(n)       (FLAGS(n)&ONSTACK_F)
00116 #define ISPARENT(n)      (FLAGS(n)&PARENT_F)
00117 #define ONPATH(n)        (FLAGS(n)&PATH_F)
00118 #define NEIGHBOR(n)      (FLAGS(n)&NEIGHBOR_F)
00119 
00120 #define SET_VISITED(n) (FLAGS(n) |= VISITED_F)
00121 #define SET_BCDONE(n)    (FLAGS(n) |= BCDONE_F)
00122 #define SET_ONSTACK(n)   (FLAGS(n) |= ONSTACK_F)
00123 #define SET_PARENT(n)    (FLAGS(n) |= PARENT_F)
00124 #define SET_ONPATH(n)    (FLAGS(n) |= PATH_F)
00125 #define SET_NEIGHBOR(n)  (FLAGS(n) |= NEIGHBOR_F)
00126 
00127 #define UNSET_VISITED(n) (FLAGS(n) &= ~VISITED_F)
00128 #define UNSET_BCDONE(n)  (FLAGS(n) &= ~BCDONE_F)
00129 #define UNSET_ONSTACK(n)         (FLAGS(n) &= ~ONSTACK_F)
00130 #define UNSET_NEIGHBOR(n)        (FLAGS(n) &= ~NEIGHBOR_F)
00131 
00132 #define DEGREE(n) (ND_order(n))
00133 
00134 #include <circo.h>
00135 
00136 #ifdef __cplusplus
00137 extern "C" {
00138 #endif
00139 
00140 #ifdef DEBUG
00141     extern void prData(Agnode_t * n, int pass);
00142 #endif
00143 
00144     extern void circularLayout(Agraph_t * sg);
00145 
00146 #ifdef __cplusplus
00147 }
00148 #endif
00149 #endif

Generated on Mon Mar 31 19:03:23 2008 for Graphviz by  doxygen 1.5.1