Crossings Minimization  1.0
graph_io.h File Reference

Definition of functions for reading and writing graphs. More...

#include <stdbool.h>
#include "graph.h"
Include dependency graph for graph_io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void readGraph (const char *dot_file, const char *ord_file)
 
void printGraph ()
 
void writeOrd (const char *ord_file)
 
void writeDot (const char *dot_file_name, const char *graph_name, const char *header_information, const Edgeptr *edge_list, int edge_list_length)
 
void renumberNodesUsingDotFile (const char *dot_file)
 

Detailed Description

Definition of functions for reading and writing graphs.

Author
Matt Stallmann, based on Saurabh Gupta's crossing heuristics implementation.
Date
2008/12/19
Id
graph_io.h 90 2014-08-13 20:31:25Z mfms

Definition in file graph_io.h.

Function Documentation

◆ printGraph()

void printGraph ( )

Prints the graph in a verbose format on standard output for debugging purposes. May also be used for piping to a graphical trace later.

Definition at line 486 of file graph_io.c.

References getAverageNumberOfProbes(), graph_name, main(), number_of_layers, number_of_nodes, printGraph(), printLayer(), and readGraph().

Referenced by printGraph().

Here is the call graph for this function:

◆ readGraph()

void readGraph ( const char *  dot_file,
const char *  ord_file 
)

Reads the graph from the given files, specified by their names. Each file is read twice so that arrays can be allocated to the correct size on the first pass. Also initializes all graph-related data structures and global variables.

Definition at line 363 of file graph_io.c.

References allocateAdjacencyLists(), allocateLayers(), assignNodesToLayers(), countIsolatedNodes(), createEdges(), initHashTable(), number_of_edges, number_of_isolated_nodes, number_of_layers, number_of_nodes, and removeHashTable().

Referenced by main(), printCrossings(), and printGraph().

Here is the call graph for this function:

◆ renumberNodesUsingDotFile()

void renumberNodesUsingDotFile ( const char *  dot_file)

Renumbers nodes, i.e., assigns id's, based on their order of appearance in a dot file. This is useful if converting to sgf format – see dot_and_ord_to_sgf.c; the node number will not depend on the order in the ord file and different orderings will have the same node numbers so that they can be compared.

◆ writeDot()

void writeDot ( const char *  dot_file_name,
const char *  graph_name,
const char *  header_information,
const Edgeptr edge_list,
int  edge_list_length 
)

Writes a dot file with the given name.

Parameters
dot_file_namethe output file name (including .dot extension)
header_informationwhat will go into the file before the '{' that starts the list of edges (including the graph name)
edge_listarray of (indices of) the edges to be written
edge_list_lengthlength of the edge list

◆ writeOrd()

void writeOrd ( const char *  ord_file)

Writes the current layer orderings to an ord file with the given name.

Todo:
ord file should have information about heuristic that created it, etc., embedded in it. Use of the file/graph name can be problematic if we want to check what happens when one heuristic follows another for a whole class using a script. There needs to be some way to differentiate among these files.

Definition at line 405 of file graph_io.c.

References beginLayer(), endLayer(), graph_name, number_of_layers, ordPreamble(), and writeNodes().

Referenced by create_random_tree(), end_of_iteration(), and main().

Here is the call graph for this function: