Path: blob/master/sage/graphs/planarity/graphDrawPlanar.private.h
4091 views
#ifndef GRAPH_DRAWPLANAR_PRIVATE_H1#define GRAPH_DRAWPLANAR_PRIVATE_H23/*4Planarity-Related Graph Algorithms Project5Copyright (c) 1997-2010, John M. Boyer6All rights reserved. Includes a reference implementation of the following:78* John M. Boyer. "Simplified O(n) Algorithms for Planar Graph Embedding,9Kuratowski Subgraph Isolation, and Related Problems". Ph.D. Dissertation,10University of Victoria, 2001.1112* John M. Boyer and Wendy J. Myrvold. "On the Cutting Edge: Simplified O(n)13Planarity by Edge Addition". Journal of Graph Algorithms and Applications,14Vol. 8, No. 3, pp. 241-273, 2004.1516* John M. Boyer. "A New Method for Efficiently Generating Planar Graph17Visibility Representations". In P. Eades and P. Healy, editors,18Proceedings of the 13th International Conference on Graph Drawing 2005,19Lecture Notes Comput. Sci., Volume 3843, pp. 508-511, Springer-Verlag, 2006.2021Redistribution and use in source and binary forms, with or without modification,22are permitted provided that the following conditions are met:2324* Redistributions of source code must retain the above copyright notice, this25list of conditions and the following disclaimer.2627* Redistributions in binary form must reproduce the above copyright notice, this28list of conditions and the following disclaimer in the documentation and/or29other materials provided with the distribution.3031* Neither the name of the Planarity-Related Graph Algorithms Project nor the names32of its contributors may be used to endorse or promote products derived from this33software without specific prior written permission.3435THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"36AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE37IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE38DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR39ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES40(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;41LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON42ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT43(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS44SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.45*/4647#include "graph.h"4849#ifdef __cplusplus50extern "C" {51#endif5253// Additional equipment for each graph node (edge arc or vertex)54/*55pos, start, end: used to store a visibility representation, or56horvert diagram of a planar graph.57For vertices, vertical position, horizontal range58For edges, horizontal position, vertical range59*/60typedef struct61{62int pos, start, end;63} DrawPlanar_GraphNode;6465typedef DrawPlanar_GraphNode * DrawPlanar_GraphNodeP;6667// Additional equipment for each vertex68/*69drawingFlag, ancestor, ancestorChild: used to collect information needed70to help 'draw' a visibility representation. During planar71embedding, a vertex is determined to be between its DFS parent and72a given ancestor (the vertex being processed) or beyond the parent73relative to the ancestor. In post processing, the relative74orientation of the parent and ancestor are determined,75then the notion of between/beyond resolves to above/below or76below/above depending on whether the ancestor is above or below,77respectively, the parent. The ancestorChild are used to help r78esolve this latter question.79tie[2] stores information along the external face during embedding80that is pertinent to helping break ties in the decisions about81vertical vertex positioning. When vertices are first merged82together into a bicomp, we cannot always decide right away which83vertices will be above or below others. But as we traverse the84external face removing inactive vertices, these positional ties85can be resolved.86*/87typedef struct88{89int drawingFlag, ancestor, ancestorChild;90int tie[2];91} DrawPlanar_VertexRec;9293typedef DrawPlanar_VertexRec * DrawPlanar_VertexRecP;9495#define DRAWINGFLAG_BEYOND 096#define DRAWINGFLAG_TIE 197#define DRAWINGFLAG_BETWEEN 298#define DRAWINGFLAG_BELOW 399#define DRAWINGFLAG_ABOVE 4100101typedef struct102{103// Helps distinguish initialize from re-initialize104int initialized;105106// The graph that this context augments107graphP theGraph;108109// Parallel array for additional graph node level equipment110DrawPlanar_GraphNodeP G;111112// Parallel array for additional vertex level equipment113DrawPlanar_VertexRecP V;114115// Overloaded function pointers116graphFunctionTable functions;117118} DrawPlanarContext;119120#ifdef __cplusplus121}122#endif123124#endif125126127128