Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/graphs/planarity/planarity.h
4128 views
1
#ifndef PLANARITY_H
2
#define PLANARITY_H
3
4
/*
5
Planarity-Related Graph Algorithms Project
6
Copyright (c) 1997-2010, John M. Boyer
7
All rights reserved. Includes a reference implementation of the following:
8
9
* John M. Boyer. "Simplified O(n) Algorithms for Planar Graph Embedding,
10
Kuratowski Subgraph Isolation, and Related Problems". Ph.D. Dissertation,
11
University of Victoria, 2001.
12
13
* John M. Boyer and Wendy J. Myrvold. "On the Cutting Edge: Simplified O(n)
14
Planarity by Edge Addition". Journal of Graph Algorithms and Applications,
15
Vol. 8, No. 3, pp. 241-273, 2004.
16
17
* John M. Boyer. "A New Method for Efficiently Generating Planar Graph
18
Visibility Representations". In P. Eades and P. Healy, editors,
19
Proceedings of the 13th International Conference on Graph Drawing 2005,
20
Lecture Notes Comput. Sci., Volume 3843, pp. 508-511, Springer-Verlag, 2006.
21
22
Redistribution and use in source and binary forms, with or without modification,
23
are permitted provided that the following conditions are met:
24
25
* Redistributions of source code must retain the above copyright notice, this
26
list of conditions and the following disclaimer.
27
28
* Redistributions in binary form must reproduce the above copyright notice, this
29
list of conditions and the following disclaimer in the documentation and/or
30
other materials provided with the distribution.
31
32
* Neither the name of the Planarity-Related Graph Algorithms Project nor the names
33
of its contributors may be used to endorse or promote products derived from this
34
software without specific prior written permission.
35
36
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
40
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
43
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
*/
47
48
#ifdef __cplusplus
49
extern "C" {
50
#endif
51
52
#include <string.h>
53
#include <stdlib.h>
54
#include <time.h>
55
#include <ctype.h>
56
#include "graph.h"
57
#include "platformTime.h"
58
59
#include "graphK23Search.h"
60
#include "graphK33Search.h"
61
#include "graphK4Search.h"
62
#include "graphDrawPlanar.h"
63
#include "graphColorVertices.h"
64
65
void ProjectTitle();
66
int helpMessage(char *param);
67
68
/* Functions that call the Graph Library */
69
int SpecificGraph(char command, char *infileName, char *outfileName, char *outfile2Name);
70
int RandomGraph(char command, int extraEdges, int numVertices, char *outfileName, char *outfile2Name);
71
int RandomGraphs(char command, int, int);
72
73
int makeg_main(char command, int argc, char *argv[]);
74
75
/* Command line, Menu, and Configuration */
76
int commandLine(int argc, char *argv[]);
77
int legacyCommandLine(int argc, char *argv[]);
78
int menu();
79
80
char Mode,
81
OrigOut,
82
EmbeddableOut,
83
ObstructedOut,
84
AdjListsForEmbeddingsOut,
85
quietMode;
86
87
void Reconfigure();
88
89
/* Low-level Utilities */
90
#define MAXLINE 1024
91
char Line[MAXLINE];
92
93
void Message(char *message);
94
void ErrorMessage(char *message);
95
void FlushConsole(FILE *f);
96
void Prompt(char *message);
97
98
void SaveAsciiGraph(graphP theGraph, char *filename);
99
100
int FilesEqual(char *file1Name, char *file2Name);
101
102
int GetEmbedFlags(char command);
103
char *GetAlgorithmName(char command);
104
void AttachAlgorithm(graphP theGraph, char command);
105
106
char *ConstructInputFilename(char *infileName);
107
char *ConstructPrimaryOutputFilename(char *infileName, char *outfileName, char command);
108
void WriteAlgorithmResults(graphP theGraph, int Result, char command, platform_time start, platform_time end, char *infileName);
109
110
#ifdef __cplusplus
111
}
112
#endif
113
114
#endif
115
116