hier.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /*
  2. * Copyright 2021
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * These are the four essential freedoms with GNU GPL software:
  18. * 1: freedom to run the program, for any purpose
  19. * 2: freedom to study how the program works, and change it to make it do what you wish
  20. * 3: freedom to redistribute copies to help your Free Software friends
  21. * 4: freedom to distribute copies of your modified versions to your Free Software friends
  22. * , ,
  23. * / \
  24. * ((__-^^-,-^^-__))
  25. * `-_---' `---_-'
  26. * `--|o` 'o|--'
  27. * \ ` /
  28. * ): :(
  29. * :o_o:
  30. * "-"
  31. *
  32. * SPDX-License-Identifier: GPL-3.0+
  33. * License-Filename: LICENSE
  34. */
  35. #ifndef HIER_H
  36. #define HIER_H 1
  37. /* the graph data rootgraph */
  38. extern struct gml_graph *maingraph;
  39. /* type of graph data 0=gml 1=dot 2=vcg */
  40. extern int graphtype;
  41. /* if set use priority algorithm for placement otherwise brandes and kopf */
  42. extern int option_priority;
  43. /* if set do node names instead of node label */
  44. extern int option_nnames;
  45. /* if set mirror in y direction */
  46. extern int option_mirrory;
  47. /* if set do node label popup */
  48. extern int option_popup;
  49. /* if 1 allow incremental layout for clusters if any */
  50. extern int incrlayout;
  51. /* type of barycenter, 0 is sugi2, 1 is rhp */
  52. extern int barytype;
  53. /* edgelabels on/off */
  54. extern int option_edgelabels;
  55. /* labels on/off */
  56. extern int option_labels;
  57. /* positioning mode */
  58. extern int postype;
  59. /* parser messages */
  60. extern char parsermessage[256];
  61. /* max x of end drawing */
  62. extern int maxx;
  63. /* max y of end drawing */
  64. extern int maxy;
  65. /* (x,y) spacing in the drawing raster */
  66. extern int xspacing;
  67. extern int yspacing;
  68. /* background r/g/b of drawing */
  69. extern int bgcr;
  70. extern int bgcg;
  71. extern int bgcb;
  72. /* type of level placement */
  73. extern int ranktype;
  74. /* run barycenter */
  75. extern void barycenter(struct gml_graph *g, int it1val, int it2val);
  76. /* longest path algorithm */
  77. extern void longestpath(struct gml_graph *g);
  78. /* reorg nodelist */
  79. extern void reorg(struct gml_graph *g);
  80. /* prepare */
  81. extern void prep(struct gml_graph *g);
  82. /* set edges with labels */
  83. extern void prepel(struct gml_graph *g);
  84. /* determine startnodes */
  85. extern void startnodes(struct gml_graph *g);
  86. /* determine startnodes */
  87. extern void startnodesafter(struct gml_graph *g);
  88. /* final after barycenter */
  89. extern void finalafter(struct gml_graph *g);
  90. /* prepare */
  91. extern void prepincr(struct gml_graph *g);
  92. /* write graph data as dia diagram */
  93. extern void graph2dia(struct gml_graph *g, FILE * fout);
  94. /* write graph data as jgf json */
  95. extern void graph2jgf(struct gml_graph *g, FILE * fout);
  96. /* calculate edge connections */
  97. extern void edgeconnections(struct gml_graph *g);
  98. /* clear self-edges node list */
  99. extern void clear_selfedgesnodelist_r(struct gml_graph *g);
  100. /* clear nr. of edges between level n and n+1 */
  101. extern void clear_nume_r(struct gml_graph *g);
  102. /* clear arrays in/out edges */
  103. extern void clear_ioedges_r(struct gml_graph *g);
  104. /* clear the s/t list of a node */
  105. extern void clear_stlist(struct gml_node *node);
  106. /* clear the s/t list of all nodes */
  107. extern void clear_stlist_all(struct gml_graph *g);
  108. /* free nodelist and nodes */
  109. extern void clear_rawnodelist(struct gml_graph *g);
  110. /* free edgelist */
  111. extern void clear_rawedgelist(struct gml_graph *g);
  112. /* clear optional edge label data */
  113. extern void clear_edgelabeldata(struct gml_graph *g);
  114. /* free nodelist and nodes */
  115. extern void clear_nodelist_r(struct gml_graph *g, int mode);
  116. /* free single nodelist */
  117. extern void clear_singlenodelist_r(struct gml_graph *g);
  118. /* free edgelist */
  119. extern void clear_edgelist_r(struct gml_graph *g);
  120. /* rebuild nodes st lists */
  121. extern void make_stlist(struct gml_graph *g);
  122. /* delete edge */
  123. extern void del_edge(struct gml_graph *g, struct gml_elist *edgeel);
  124. /* splits edgelabel edges into node->label->node */
  125. extern void edgelabels(struct gml_graph *g, int mode);
  126. /* break cycles in the graph */
  127. extern void uncycle(struct gml_graph *g);
  128. /* all edges downwards */
  129. extern void edgesdownwards(struct gml_graph *g, int mode);
  130. /* set rel. y level of all nodes */
  131. extern void ylevels(struct gml_graph *g);
  132. /* dfs check again and revers if needed */
  133. extern void edgelen(struct gml_graph *g);
  134. /* try to find shorter edges */
  135. extern void shorteredges(struct gml_graph *g);
  136. /* doublespace the vertical levels */
  137. extern void doublespacey(struct gml_graph *g);
  138. /* doublespace the vertical levels */
  139. extern void doublespaceyafter(struct gml_graph *g);
  140. /* check for same edges */
  141. extern void checksame(struct gml_graph *g);
  142. /* split same edges */
  143. extern void splitsame(struct gml_graph *g);
  144. /* split longer edges */
  145. extern void splitedges(struct gml_graph *g, int after);
  146. /* split longer edges */
  147. extern void splitedgesafter(struct gml_graph *g);
  148. /* create level node count data */
  149. extern void nodecounts(struct gml_graph *g);
  150. /* create level node count data */
  151. extern void nodecountsafter(struct gml_graph *g);
  152. /* */
  153. extern void add_new_node(struct gml_graph *g, struct gml_graph *ro, int nr,
  154. int foundid, char *nodename, char *nodelabel, int ncolor, int nbcolor, struct gml_rl *rlabel,
  155. struct gml_hl *hlabel, int fontcolor, int ishtml);
  156. /* */
  157. extern void add_new_dummynode(struct gml_graph *g, int foundid);
  158. /* */
  159. extern void
  160. add_new_edge(struct gml_graph *g, struct gml_graph *ro, int foundsource,
  161. int foundtarget, char *elabel, int ecolor, int style, char *fcompass, char *tcompass, int constraint, int ishtml);
  162. /* */
  163. extern void add_new_dummyedge(struct gml_graph *g, struct gml_edge *rawedge, struct gml_graph *ro,
  164. int foundsource, int foundtarget, int reversed,
  165. int ecolor, int style, char *fcompass, char *tcompass, int constraint, struct gml_el *eldata);
  166. /* lists per position */
  167. extern void make_posnodes(struct gml_graph *g);
  168. /* clear pos. nodes lists */
  169. extern void clear_posnodes_r(struct gml_graph *g);
  170. /* lists per level */
  171. extern void make_levelnodes(struct gml_graph *g);
  172. /* clear level nodes lists */
  173. extern void clear_levelnodes_r(struct gml_graph *g);
  174. /* clear list of startnodes */
  175. extern void clear_startnodes_r(struct gml_graph *g);
  176. /* clear record labels */
  177. extern void clear_rlabel_r(struct gml_graph *g);
  178. /* clear html labels */
  179. extern void clear_hlabel_r(struct gml_graph *g);
  180. /* */
  181. extern void clear_numce_r(struct gml_graph *g);
  182. /* clear number of nodes at level */
  183. extern void clear_nnl_r(struct gml_graph *g);
  184. /* clear subgraphs and optional summary node */
  185. extern void clear_sg(struct gml_graph *sg);
  186. /* create root graph */
  187. extern void create_maingraph(void);
  188. /* create subgraphs */
  189. extern void create_sg(int nr, char *name, char *label, int type);
  190. #endif
  191. /* end */