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
25
26typedef struct {
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 */
40typedef struct {
41 union { /* Pointer to node/cluster in original graph */
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;
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
69typedef 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
124extern "C" {
125#endif
126
127#ifdef DEBUG
128 extern void prData(Agnode_t * n, int pass);
129#endif
130
131void circularLayout(Agraph_t *sg, Agraph_t *rg, int *blockCount);
132
133#ifdef __cplusplus
134}
135#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:639
Definition block.h:26
node_t * next
Definition circular.h:50
Agnode_t * np
Definition circular.h:43
int flags
Definition circular.h:45
double psi
Definition circular.h:64
node_t * first
Definition circular.h:57
node_t * second
Definition circular.h:58
int fdist
Definition circular.h:59
block_t * block
Definition circular.h:47
int low_val
Definition circular.h:52
int val
Definition circular.h:51
int pos
Definition circular.h:63
int sdist
Definition circular.h:60
node_t * tparent
Definition circular.h:56
node_t * parent
Definition circular.h:46
Agraph_t * g
Definition circular.h:42
node_t * clone
Definition circular.h:54
double min_dist
Definition circular.h:23
int graphCopyCount
how many cloned graphs have we created?
Definition circular.h:20
int orderCount
Definition circular.h:18
char * rootname
Definition circular.h:22
int blockCount
Definition circular.h:19
attrsym_t * N_root
Definition circular.h:21
blocklist_t bl
Definition circular.h:17
int order
Definition circular.h:70
Agnode_t * dnode
Definition circular.h:27