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