Crossings Minimization  1.0
dot_and_ord_to_sgf.c File Reference

Program to convert a dot and ord file to an equivalent sgf file. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
#include "defs.h"
#include "graph_io.h"
#include "graph.h"
Include dependency graph for dot_and_ord_to_sgf.c:

Go to the source code of this file.

Functions

static void printUsage (void)
 
static void write_sgf (void)
 
int main (int argc, char *argv[])
 

Detailed Description

Program to convert a dot and ord file to an equivalent sgf file.

Author
Matt Stallmann
Date
2011/06/16

sgf format is as follows (blank lines are ignored): c comment line 1 ... c comment line k

t graph_name nodes edges layers

n id_1 layer_1 position_1 n id_2 layer_2 position_2 ... n id_n layer_n position_n

e source_1 target_1 ... e source_m target_m

edges are directed so that the nodes appearing earlier in the input are sources

Todo:
comments from the original dot file are not preserved and should be added by an external script for now.

Deviations (not relevant here):

  • edge direction may not be correct yet, but can be fixed using sgfDirect.awk
  • nodes, edges, and layers may be missing in the title (t) line, but can be deduced
  • the 'n' lines may be missing, but can be deduced from the title
  • layers and positions may be missing in the 'n' lines but can be filled in by existing programs and/or scripts
  • the 'e' lines may have additional information, e.g., to identify edges as 'favored' (details not worked out yet)
Id
dot_and_ord_to_sgf.c 73 2014-07-17 20:36:15Z mfms

Definition in file dot_and_ord_to_sgf.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 101 of file dot_and_ord_to_sgf.c.

References printUsage(), readGraph(), and write_sgf().

Here is the call graph for this function:

◆ printUsage()

static void printUsage ( void  )
static

prints usage message

Definition at line 57 of file dot_and_ord_to_sgf.c.

Referenced by main().

◆ write_sgf()

static void write_sgf ( void  )
static

Writes an sgf file based on the current graph to standard output

Definition at line 66 of file dot_and_ord_to_sgf.c.

References graph_name, node_struct::id, layers, layer_struct::nodes, number_of_edges, number_of_layers, layer_struct::number_of_nodes, number_of_nodes, node_struct::up_degree, node_struct::up_edges, and edge_struct::up_node.

Referenced by main().