Crossings Minimization  1.0
dot.h
Go to the documentation of this file.
1 /**
2  * @file dot.h
3  * @brief
4  * Module for reading files in .dot format
5  * @author Matt Stallmann
6  * @date 1998/07/17, modified for new experiments 2008/12/17
7  * $Id: dot.h 2 2011-06-07 19:50:41Z mfms $
8  */
9 
10 // Copyright (C) 2001 Matthias Stallmann.
11 // Contact: matt_stallmann@ncsu.edu
12 //
13 // This program is free software; you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation; either version 2 of the License, or
16 // (at your option) any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License along
24 // with this program (file COPYING.txt); if not, write to the Free Software
25 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
26 // USA.
27 
28 #ifndef DOT_H
29 #define DOT_H
30 
31 #include<stdio.h>
32 #include<stdbool.h>
33 
34 /* ----------- INPUT FUNCTIONS -------------- */
35 
36 /**
37  * Stores information about the dot file and
38  * advances the input to the point where edges can be read.
39  * NOTE: information in an initial comment is lost
40  */
41 void initDot( FILE * in );
42 
43 /**
44  * Stores the name of the graph in the given buffer. Assumes the buffer is
45  * large enough.
46  */
47 void getNameFromDotFile( char * buffer );
48 
49 /**
50  * Reads the next edge from the input, storing the names of the vertices in
51  * buffers. Assumes the buffers are large enough.
52  * @return true if another edge was found.
53  */
54 bool nextEdge( FILE * in, char * source_buffer, char * destination_buffer );
55 
56 // The typical way to read a dot file from stream 'in' is ...
57 //
58 // initDot( in );
59 // char name_buf[MAX_NAME_LENGTH];
60 // get_name( name_buf );
61 // // do something with the name
62 // char src_buf[MAX_NAME_LENGTH];
63 // char dst_buf[MAX_NAME_LENGTH];
64 // while ( nextEdge( in, src_buf, dst_buf ) )
65 // {
66 // // do something with the edge
67 // }
68 
69 /* ----------- OUTPUT FUNCTIONS -------------- */
70 
71 /**
72  * Writes the first part of a dot file to the output stream: comments about
73  * how the graph was created and seed information
74  */
75 void dotPreamble( FILE * out,
76  const char * graph_name,
77  const char * initial_comment );
78 
79 /**
80  * Writes the final '}'
81  */
82 void endDot( FILE * out );
83 
84 /**
85  * Writes the edge (src, dst) to the output
86  */
87 void outputEdge( FILE * out,
88  const char * src, const char * dst );
89 
90 #endif
91 
92 /* [Last modified: 2011 04 19 at 20:31:55 GMT] */
93 
void getNameFromDotFile(char *buffer)
Definition: dot.c:167
static char buffer[MAX_NAME_LENGTH]
Definition: heuristics.c:59
void initDot(FILE *in)
Definition: dot.c:144
bool nextEdge(FILE *in, char *source_buffer, char *destination_buffer)
Definition: dot.c:172
void outputEdge(FILE *out, const char *src, const char *dst)
Definition: dot.c:222
static char graph_name[MAX_NAME_LENGTH]
Definition: dot.c:42
void endDot(FILE *out)
Definition: dot.c:217
void dotPreamble(FILE *out, const char *graph_name, const char *initial_comment)
Definition: dot.c:210