Graphviz  2.39.20141220.0545
circular.h
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #ifndef CIRCULAR_H
15 #define CIRCULAR_H
16 
17 #include "render.h"
18 #include "block.h"
19 
20 typedef struct {
26  char *rootname;
27  double min_dist;
28 } circ_state;
29 
30 typedef struct {
32 } ndata;
33 
34 /* Extra node data used for layout:
35  * Pass O: build derived graph
36  * Pass 1: construct blocks
37  * Pass 2: construct block tree
38  * Pass 3: layout block
39  * a: construct block skeleton
40  * b: construct skeleton spanning tree
41  * c: construct circular list of nodes
42  * Pass 4: connect blocks
43  */
44 typedef struct {
45  union { /* Pointer to node/cluster in original graph */
48  } orig;
49  int flags;
50  node_t *parent; /* parent in block-cutpoint traversal (1,2,4) */
51  block_t *block; /* Block containing node (1,2,3,4) */
52  union {
53  struct { /* Pass 1 */
54  node_t *next; /* used for stack */
55  int val;
56  int low_val;
57  } bc;
58  node_t *clone; /* Cloned node (3a) */
59  struct { /* Spanning tree and longest path (3b) */
60  node_t *tparent; /* Parent in tree */
61  node_t *first; /* Leaf on longest path from node */
62  node_t *second; /* Leaf on 2nd longest path from node */
63  int fdist; /* Length of longest path from node */
64  int sdist; /* Length of 2nd longest path from node */
65  } t;
66  struct {
67  int pos; /* Index of node in block circle (3c,4) */
68  double psi; /* Offset angle of children (4) */
69  } f;
70  } u;
71 } cdata;
72 
73 typedef struct {
74  int order;
76 } edata;
77 
78 #define NDATA(n) ((ndata*)(ND_alg(n)))
79 #define DNODE(n) (NDATA(n)->dnode)
80 
81 #define EDGEDATA(e) ((edata*)(ED_alg(e)))
82 #define ENEXT(e) (EDGEDATA(e)->next)
83 #define EDGEORDER(e) (EDGEDATA(e)->order)
84 
85 #define DATA(n) ((cdata*)(ND_alg(n)))
86 #define ORIGG(n) (DATA(n)->orig.g)
87 #define ORIGN(n) (DATA(n)->orig.np)
88 #define FLAGS(n) (DATA(n)->flags)
89 #define PARENT(n) (DATA(n)->parent)
90 #define BLOCK(n) (DATA(n)->block)
91 #define NEXT(n) (DATA(n)->u.bc.next)
92 #define VAL(n) (DATA(n)->u.bc.val)
93 #define LOWVAL(n) (DATA(n)->u.bc.low_val)
94 #define CLONE(n) (DATA(n)->u.clone)
95 #define TPARENT(n) (DATA(n)->u.t.tparent)
96 #define LEAFONE(n) (DATA(n)->u.t.first)
97 #define LEAFTWO(n) (DATA(n)->u.t.second)
98 #define DISTONE(n) (DATA(n)->u.t.fdist)
99 #define DISTTWO(n) (DATA(n)->u.t.sdist)
100 #define POSITION(n) (DATA(n)->u.f.pos)
101 #define PSI(n) (DATA(n)->u.f.psi)
102 
103 #define VISITED_F (1 << 0)
104 #define ONSTACK_F (1 << 2)
105 #define PARENT_F (1 << 3)
106 #define PATH_F (1 << 4)
107 #define NEIGHBOR_F (1 << 5)
108 
109 #define VISITED(n) (FLAGS(n)&VISITED_F)
110 #define ONSTACK(n) (FLAGS(n)&ONSTACK_F)
111 #define ISPARENT(n) (FLAGS(n)&PARENT_F)
112 #define ONPATH(n) (FLAGS(n)&PATH_F)
113 #define NEIGHBOR(n) (FLAGS(n)&NEIGHBOR_F)
114 
115 #define SET_VISITED(n) (FLAGS(n) |= VISITED_F)
116 #define SET_ONSTACK(n) (FLAGS(n) |= ONSTACK_F)
117 #define SET_PARENT(n) (FLAGS(n) |= PARENT_F)
118 #define SET_ONPATH(n) (FLAGS(n) |= PATH_F)
119 #define SET_NEIGHBOR(n) (FLAGS(n) |= NEIGHBOR_F)
120 
121 #define UNSET_VISITED(n) (FLAGS(n) &= ~VISITED_F)
122 #define UNSET_ONSTACK(n) (FLAGS(n) &= ~ONSTACK_F)
123 #define UNSET_NEIGHBOR(n) (FLAGS(n) &= ~NEIGHBOR_F)
124 
125 #define DEGREE(n) (ND_order(n))
126 
127 #include <circo.h>
128 
129 #ifdef __cplusplus
130 extern "C" {
131 #endif
132 
133 #ifdef DEBUG
134  extern void prData(Agnode_t * n, int pass);
135 #endif
136 
137  extern void circularLayout(Agraph_t * sg, Agraph_t* rg);
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 #endif
int low_val
Definition: circular.h:56
double psi
Definition: circular.h:68
block_t * block
Definition: circular.h:51
int pos
Definition: circular.h:67
attrsym_t * N_root
Definition: circular.h:25
Agnode_t * dnode
Definition: circular.h:31
Definition: circular.h:73
node_t * first
Definition: circular.h:61
int val
Definition: circular.h:55
node_t * second
Definition: circular.h:62
int flags
Definition: circular.h:49
int fdist
Definition: circular.h:63
node_t * parent
Definition: circular.h:50
int blockCount
Definition: circular.h:23
Definition: circular.h:44
int orderCount
Definition: circular.h:22
double min_dist
Definition: circular.h:27
Definition: circular.h:30
char * rootname
Definition: circular.h:26
node_t * next
Definition: circular.h:54
Agedge_t * next
Definition: circular.h:75
attrsym_t * N_artpos
Definition: circular.h:24
Definition: block.h:30
int sdist
Definition: circular.h:64
blocklist_t bl
Definition: circular.h:21
int order
Definition: circular.h:74
void circularLayout(Agraph_t *sg, Agraph_t *rg)
Definition: circular.c:92
node_t * clone
Definition: circular.h:58
node_t * tparent
Definition: circular.h:60
Agnode_t * np
Definition: circular.h:47
Agraph_t * g
Definition: circular.h:46