|
1 | | -#ifndef GRAPH_H |
2 | | -#define GRAPH_H |
3 | | - |
4 | | -/* |
5 | | -Planarity-Related Graph Algorithms Project |
6 | | -Copyright (c) 1997-2012, John M. Boyer |
7 | | -All rights reserved. Includes a reference implementation of the following: |
8 | | -
|
9 | | -* John M. Boyer. "Subgraph Homeomorphism via the Edge Addition Planarity Algorithm". |
10 | | - Journal of Graph Algorithms and Applications, Vol. 16, no. 2, pp. 381-410, 2012. |
11 | | - http://www.jgaa.info/16/268.html |
12 | | -
|
13 | | -* John M. Boyer. "A New Method for Efficiently Generating Planar Graph |
14 | | - Visibility Representations". In P. Eades and P. Healy, editors, |
15 | | - Proceedings of the 13th International Conference on Graph Drawing 2005, |
16 | | - Lecture Notes Comput. Sci., Volume 3843, pp. 508-511, Springer-Verlag, 2006. |
17 | | -
|
18 | | -* John M. Boyer and Wendy J. Myrvold. "On the Cutting Edge: Simplified O(n) |
19 | | - Planarity by Edge Addition". Journal of Graph Algorithms and Applications, |
20 | | - Vol. 8, No. 3, pp. 241-273, 2004. |
21 | | - http://www.jgaa.info/08/91.html |
22 | | -
|
23 | | -* John M. Boyer. "Simplified O(n) Algorithms for Planar Graph Embedding, |
24 | | - Kuratowski Subgraph Isolation, and Related Problems". Ph.D. Dissertation, |
25 | | - University of Victoria, 2001. |
26 | | -
|
27 | | -Redistribution and use in source and binary forms, with or without modification, |
28 | | -are permitted provided that the following conditions are met: |
29 | | -
|
30 | | -* Redistributions of source code must retain the above copyright notice, this |
31 | | - list of conditions and the following disclaimer. |
32 | | -
|
33 | | -* Redistributions in binary form must reproduce the above copyright notice, this |
34 | | - list of conditions and the following disclaimer in the documentation and/or |
35 | | - other materials provided with the distribution. |
36 | | -
|
37 | | -* Neither the name of the Planarity-Related Graph Algorithms Project nor the names |
38 | | - of its contributors may be used to endorse or promote products derived from this |
39 | | - software without specific prior written permission. |
40 | | -
|
41 | | -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
42 | | -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | | -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
44 | | -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
45 | | -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
46 | | -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
47 | | -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
48 | | -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
49 | | -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
50 | | -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | | -*/ |
52 | | - |
53 | | -#ifdef __cplusplus |
54 | | -extern "C" { |
55 | | -#endif |
56 | | - |
57 | | -#include "graphStructures.h" |
58 | | - |
59 | | -#include "graphExtensions.h" |
60 | | - |
61 | | -/////////////////////////////////////////////////////////////////////////////// |
62 | | -// Definitions for higher-order operations at the vertex, edge and graph levels |
63 | | -/////////////////////////////////////////////////////////////////////////////// |
64 | | - |
65 | | -graphP gp_New(void); |
66 | | - |
67 | | -int gp_InitGraph(graphP theGraph, int N); |
68 | | -void gp_ReinitializeGraph(graphP theGraph); |
69 | | -int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph); |
70 | | -int gp_CopyGraph(graphP dstGraph, graphP srcGraph); |
71 | | -graphP gp_DupGraph(graphP theGraph); |
72 | | - |
73 | | -int gp_CreateRandomGraph(graphP theGraph); |
74 | | -int gp_CreateRandomGraphEx(graphP theGraph, int numEdges); |
75 | | - |
76 | | -void gp_Free(graphP *pGraph); |
77 | | - |
78 | | -int gp_Read(graphP theGraph, char *FileName); |
79 | | -#define WRITE_ADJLIST 1 |
80 | | -#define WRITE_ADJMATRIX 2 |
81 | | -#define WRITE_DEBUGINFO 3 |
82 | | -int gp_Write(graphP theGraph, char *FileName, int Mode); |
83 | | - |
84 | | -int gp_IsNeighbor(graphP theGraph, int u, int v); |
85 | | -int gp_GetNeighborEdgeRecord(graphP theGraph, int u, int v); |
86 | | -int gp_GetVertexDegree(graphP theGraph, int v); |
87 | | -int gp_GetVertexInDegree(graphP theGraph, int v); |
88 | | -int gp_GetVertexOutDegree(graphP theGraph, int v); |
89 | | - |
90 | | -int gp_GetArcCapacity(graphP theGraph); |
91 | | -int gp_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity); |
92 | | - |
93 | | -int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink); |
94 | | -int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, |
95 | | - int v, int e_v, int e_vlink); |
96 | | - |
97 | | -void gp_HideEdge(graphP theGraph, int e); |
98 | | -void gp_RestoreEdge(graphP theGraph, int e); |
99 | | -int gp_HideVertex(graphP theGraph, int vertex); |
100 | | -int gp_DeleteEdge(graphP theGraph, int e, int nextLink); |
101 | | - |
102 | | -int gp_ContractEdge(graphP theGraph, int e); |
103 | | -int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore); |
104 | | -int gp_RestoreVertices(graphP theGraph); |
105 | | - |
106 | | -int gp_CreateDFSTree(graphP theGraph); |
107 | | -int gp_SortVertices(graphP theGraph); |
108 | | -int gp_LowpointAndLeastAncestor(graphP theGraph); |
109 | | -int gp_PreprocessForEmbedding(graphP theGraph); |
110 | | - |
111 | | -int gp_Embed(graphP theGraph, int embedFlags); |
112 | | -int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult); |
113 | | - |
114 | | -/* Possible Flags for gp_Embed. The planar and outerplanar settings are supported |
115 | | - natively. The rest require extension modules. */ |
116 | | - |
117 | | -#define EMBEDFLAGS_PLANAR 1 |
118 | | -#define EMBEDFLAGS_OUTERPLANAR 2 |
119 | | - |
120 | | -#define EMBEDFLAGS_DRAWPLANAR (4|EMBEDFLAGS_PLANAR) |
121 | | - |
122 | | -#define EMBEDFLAGS_SEARCHFORK23 (16|EMBEDFLAGS_OUTERPLANAR) |
123 | | -#define EMBEDFLAGS_SEARCHFORK4 (32|EMBEDFLAGS_OUTERPLANAR) |
124 | | -#define EMBEDFLAGS_SEARCHFORK33 (64|EMBEDFLAGS_PLANAR) |
125 | | - |
126 | | -#define EMBEDFLAGS_SEARCHFORK5 (128|EMBEDFLAGS_PLANAR) |
127 | | - |
128 | | -#define EMBEDFLAGS_MAXIMALPLANARSUBGRAPH 256 |
129 | | -#define EMBEDFLAGS_PROJECTIVEPLANAR 512 |
130 | | -#define EMBEDFLAGS_TOROIDAL 1024 |
131 | | - |
132 | | -/* If LOGGING is defined, then write to the log, otherwise no-op |
133 | | - By default, neither release nor DEBUG builds including LOGGING. |
134 | | - Logging is useful for seeing details of how various algorithms |
135 | | - handle a particular graph. */ |
136 | | - |
137 | | -//#define LOGGING |
138 | | -#ifdef LOGGING |
139 | | - |
140 | | -#define gp_LogLine _LogLine |
141 | | -#define gp_Log _Log |
142 | | - |
143 | | -void _LogLine(char *Line); |
144 | | -void _Log(char *Line); |
145 | | - |
146 | | -#define gp_MakeLogStr1 _MakeLogStr1 |
147 | | -#define gp_MakeLogStr2 _MakeLogStr2 |
148 | | -#define gp_MakeLogStr3 _MakeLogStr3 |
149 | | -#define gp_MakeLogStr4 _MakeLogStr4 |
150 | | -#define gp_MakeLogStr5 _MakeLogStr5 |
151 | | - |
152 | | -char *_MakeLogStr1(char *format, int); |
153 | | -char *_MakeLogStr2(char *format, int, int); |
154 | | -char *_MakeLogStr3(char *format, int, int, int); |
155 | | -char *_MakeLogStr4(char *format, int, int, int, int); |
156 | | -char *_MakeLogStr5(char *format, int, int, int, int, int); |
157 | | - |
158 | | -#else |
159 | | -#define gp_LogLine(Line) |
160 | | -#define gp_Log(Line) |
161 | | -#define gp_MakeLogStr1(format, one) |
162 | | -#define gp_MakeLogStr2(format, one, two) |
163 | | -#define gp_MakeLogStr3(format, one, two, three) |
164 | | -#define gp_MakeLogStr4(format, one, two, three, four) |
165 | | -#define gp_MakeLogStr5(format, one, two, three, four, five) |
166 | | -#endif |
167 | | - |
168 | | -#ifdef __cplusplus |
169 | | -} |
170 | | -#endif |
171 | | - |
172 | | -#endif |
| 1 | +#ifndef HELPERSTUB_GRAPH_H |
| 2 | +#define HELPERSTUB_GRAPH_H |
| 3 | + |
| 4 | +/* |
| 5 | +Copyright (c) 1997-2025, John M. Boyer |
| 6 | +All rights reserved. |
| 7 | +See the LICENSE.TXT file for licensing information. |
| 8 | +*/ |
| 9 | + |
| 10 | +// NOTE: This helper stub has been added for backwards compatibility to |
| 11 | +// support downstream consumers who expect graph.h to be at the |
| 12 | +// root of the installed planarity headers directory. Future downstream |
| 13 | +// consumers are advised to include the graphLib.h helper stub instead |
| 14 | +// because it offers access to all features in the graph library of |
| 15 | +// the planarity project. |
| 16 | + |
| 17 | +#ifdef __cplusplus |
| 18 | +extern "C" |
| 19 | +{ |
| 20 | +#endif |
| 21 | + |
| 22 | +#include "c/graphLib/graph.h" |
| 23 | + |
| 24 | +#ifdef __cplusplus |
| 25 | +} |
| 26 | +#endif |
| 27 | + |
| 28 | +#endif |
0 commit comments