Crossings Minimization  1.0
crossing_utilities.h
Go to the documentation of this file.
1 /**
2  * @file crossing_utilities.h
3  * @brief Definition of functions that are used to count and update crossings
4  * locally. Used both by crossings.c and by sifting.c.
5  *
6  * @author Matt Stallmann
7  * @date 2009/05/15
8  * $Id: crossing_utilities.h 56 2014-03-13 21:12:01Z mfms $
9  */
10 
11 #include<stdbool.h>
12 
13 #ifndef CROSSING_UTILITIES_H
14 #define CROSSING_UTILITIES_H
15 
16 #include"defs.h"
17 #include"graph.h"
18 
19 /**
20  * Counts the inversions when an array of edges and updates crossings for the
21  * edges and their nodes accordingly [*** this is a side effect ***].
22  *
23  * @param edge_array an array of edges sorted by their down nodes
24  * @param number_of_edges number of edges in the array
25  * @param diff indicates whether to increment the crossing counts (+1) or
26  * decrement them (-1); the latter is used for updates during sifting.
27  *
28  * @return the total number of crossings (inversions)
29  */
30 int count_inversions_up( Edgeptr * edge_array, int number_of_edges,
31  int diff );
32 
33 /**
34  * Inserts the edge at starting_index into the already sorted edges with
35  * indices 0, ..., starting_index - 1. Sort is by up_node. Each inversion
36  * either increments (diff=1) or decrements (diff=-1) the number of crossings
37  * for the edges involved and their endpoints.
38  *
39  * @return the total number of crossings (inversions)
40  */
41 int insert_and_count_inversions_up( Edgeptr * edge_array,
42  int starting_index,
43  int diff );
44 
45 /**
46  * Counts the inversions when an array of edges and updates crossings for the
47  * edges and their nodes accordingly [*** this is a side effect ***].
48  *
49  * @param edge_array an array of edges sorted by their up nodes
50  * @param number_of_edges number of edges in the array
51  * @param diff indicates whether to increment the crossing counts (+1) or
52  * decrement them (-1); the latter is used for updates during sifting.
53  *
54  * @return the total number of crossings (inversions)
55  */
56 int count_inversions_down( Edgeptr * edge_array, int number_of_edges,
57  int diff );
58 
59 /**
60  * Inserts the edge at starting_index into the already sorted edges with
61  * indices 0, ..., starting_index - 1. Sort is by down_node. Each inversion
62  * either increments (diff=1) or decrements (diff=-1) the number of crossings
63  * for the edges involved and their endpoints.
64  *
65  * @return the total number of crossings (inversions)
66  */
68  int starting_index,
69  int diff );
70 
71 /**
72  * Adds edges to an array of edges. Assumes that there is enough space in the
73  * array. Similar to strcat()
74  * @param edge_array the array to which edges are to be added
75  * @param edges_to_add an array of the edges to be added
76  * @param num_edges the number of edges to add
77  * @param start_pos the starting position at which the edges are to be
78  * added.
79  */
80 void add_edges_to_array( Edgeptr * edge_array, Edgeptr * edges_to_add,
81  int num_edges, int start_pos );
82 
83 #endif
84 
85 /* [Last modified: 2014 03 10 at 16:37:54 GMT] */
int count_inversions_up(Edgeptr *edge_array, int number_of_edges, int diff)
int count_inversions_down(Edgeptr *edge_array, int number_of_edges, int diff)
int insert_and_count_inversions_down(Edgeptr *edge_array, int starting_index, int diff)
Definitions common to all edge crossing heuristic source files.
void add_edges_to_array(Edgeptr *edge_array, Edgeptr *edges_to_add, int num_edges, int start_pos)
Definition of data structures and access functions for a layered graph.
int number_of_edges
Definition: graph_io.c:29
int insert_and_count_inversions_up(Edgeptr *edge_array, int starting_index, int diff)