Graphviz 13.0.0~dev.20241220.2304
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
26
27typedef struct {
29} ndata;
30
31/* Extra node data used for layout:
32 * Pass O: build derived graph
33 * Pass 1: construct blocks
34 * Pass 2: construct block tree
35 * Pass 3: layout block
36 * a: construct block skeleton
37 * b: construct skeleton spanning tree
38 * c: construct circular list of nodes
39 * Pass 4: connect blocks
40 */
41typedef struct {
42 union { /* Pointer to node/cluster in original graph */
45 } orig;
46 int flags;
47 node_t *parent; /* parent in block-cutpoint traversal (1,2,4) */
48 block_t *block; /* Block containing node (1,2,3,4) */
49 union {
50 struct { /* Pass 1 */
51 node_t *next; /* used for stack */
52 int val;
54 } bc;
55 node_t *clone; /* Cloned node (3a) */
56 struct { /* Spanning tree and longest path (3b) */
57 node_t *tparent; /* Parent in tree */
58 node_t *first; /* Leaf on longest path from node */
59 node_t *second; /* Leaf on 2nd longest path from node */
60 int fdist; /* Length of longest path from node */
61 int sdist; /* Length of 2nd longest path from node */
62 } t;
63 struct {
64 int pos; /* Index of node in block circle (3c,4) */
65 double psi; /* Offset angle of children (4) */
66 } f;
67 } u;
68} cdata;
69
70typedef struct {
71 int order;
72} edata;
73
74#define NDATA(n) ((ndata*)(ND_alg(n)))
75#define DNODE(n) (NDATA(n)->dnode)
76
77#define EDGEDATA(e) ((edata*)(ED_alg(e)))
78#define EDGEORDER(e) (EDGEDATA(e)->order)
79
80#define DATA(n) ((cdata*)(ND_alg(n)))
81#define ORIGG(n) (DATA(n)->orig.g)
82#define ORIGN(n) (DATA(n)->orig.np)
83#define FLAGS(n) (DATA(n)->flags)
84#define PARENT(n) (DATA(n)->parent)
85#define BLOCK(n) (DATA(n)->block)
86#define NEXT(n) (DATA(n)->u.bc.next)
87#define VAL(n) (DATA(n)->u.bc.val)
88#define LOWVAL(n) (DATA(n)->u.bc.low_val)
89#define CLONE(n) (DATA(n)->u.clone)
90#define TPARENT(n) (DATA(n)->u.t.tparent)
91#define LEAFONE(n) (DATA(n)->u.t.first)
92#define LEAFTWO(n) (DATA(n)->u.t.second)
93#define DISTONE(n) (DATA(n)->u.t.fdist)
94#define DISTTWO(n) (DATA(n)->u.t.sdist)
95#define POSITION(n) (DATA(n)->u.f.pos)
96#define PSI(n) (DATA(n)->u.f.psi)
97
98#define VISITED_F (1 << 0)
99#define ONSTACK_F (1 << 2)
100#define PARENT_F (1 << 3)
101#define PATH_F (1 << 4)
102#define NEIGHBOR_F (1 << 5)
103
104#define VISITED(n) (FLAGS(n)&VISITED_F)
105#define ONSTACK(n) (FLAGS(n)&ONSTACK_F)
106#define ISPARENT(n) (FLAGS(n)&PARENT_F)
107#define ONPATH(n) (FLAGS(n)&PATH_F)
108#define NEIGHBOR(n) (FLAGS(n)&NEIGHBOR_F)
109
110#define SET_VISITED(n) (FLAGS(n) |= VISITED_F)
111#define SET_ONSTACK(n) (FLAGS(n) |= ONSTACK_F)
112#define SET_PARENT(n) (FLAGS(n) |= PARENT_F)
113#define SET_ONPATH(n) (FLAGS(n) |= PATH_F)
114#define SET_NEIGHBOR(n) (FLAGS(n) |= NEIGHBOR_F)
115
116#define UNSET_VISITED(n) (FLAGS(n) &= ~VISITED_F)
117#define UNSET_ONSTACK(n) (FLAGS(n) &= ~ONSTACK_F)
118#define UNSET_NEIGHBOR(n) (FLAGS(n) &= ~NEIGHBOR_F)
119
120#define DEGREE(n) (ND_order(n))
121
122#include <circogen/circo.h>
123
124#ifdef __cplusplus
125extern "C" {
126#endif
127
128#ifdef DEBUG
129 extern void prData(Agnode_t * n, int pass);
130#endif
131
132void circularLayout(Agraph_t *sg, Agraph_t *rg, int *blockCount);
133
134#ifdef __cplusplus
135}
136#endif
void circularLayout(Agraph_t *sg, Agraph_t *rg, int *blockCount)
Definition circular.c:65
graph or subgraph
Definition cgraph.h:425
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:637
Definition block.h:26
node_t * next
Definition circular.h:51
Agnode_t * np
Definition circular.h:44
int flags
Definition circular.h:46
double psi
Definition circular.h:65
node_t * first
Definition circular.h:58
node_t * second
Definition circular.h:59
int fdist
Definition circular.h:60
block_t * block
Definition circular.h:48
int low_val
Definition circular.h:53
int val
Definition circular.h:52
int pos
Definition circular.h:64
int sdist
Definition circular.h:61
node_t * tparent
Definition circular.h:57
node_t * parent
Definition circular.h:47
Agraph_t * g
Definition circular.h:43
node_t * clone
Definition circular.h:55
double min_dist
Definition circular.h:24
int graphCopyCount
how many cloned graphs have we created?
Definition circular.h:20
int orderCount
Definition circular.h:18
char * rootname
Definition circular.h:23
int spanningTreeCount
how many spanning trees have we created?
Definition circular.h:21
int blockCount
Definition circular.h:19
attrsym_t * N_root
Definition circular.h:22
blocklist_t bl
Definition circular.h:17
int order
Definition circular.h:71
Agnode_t * dnode
Definition circular.h:28