/*******************************************************************************
* File: component.h
* Purpose: To contain the relevent data type definitions and macros that are
* needed by the cod ein the files component.c and ccfunct.c.
* Name: Michael Heath, University of South Florida
* Date: 2/11/2000
*******************************************************************************/

#ifndef _COMPONENTS_
#define _COMPONENTS_

#define ZERO 0
#define NONZERO 255

#define VERBOSE 0

#define CONNECTMODE 8

/*******************************************************************************
* Define a data structure to store a node of a graph. The graph will be an
* array of these structures. Each structure in the array will represent a node
* in the graph. Edges from the node will be stored in a linked list.
*******************************************************************************/
struct VERTEX{
   int row, col;    /* The pixel position in the image for this vertex. */
   struct EDGE{
      struct VERTEX *neighbor;  /* A pointer to the vertex this one is connected to by this edge. */
      struct EDGE *nextedge;    /* A pointer to the next edge. */
   } *edge;

   /* Used for the linked list representation of disjoint sets. */
   struct VERTEX *representative;
   struct VERTEX *nextset;
   struct VERTEX *last;
   int size;

   /* Used for the disjoint set forest representation of disjoint sets. */
   int rank;
   struct VERTEX *parent;
};

/*******************************************************************************
* Some function prototypes.
*******************************************************************************/
void cc_linkedlist(struct VERTEX *graph, int numberofvertices);
void cc_disjointforest(struct VERTEX *graph, int numberofvertices);

/*******************************************************************************
* This function is needed by the function label_image_df in components.c so
* it is included in this header file.
*******************************************************************************/
struct VERTEX *find_set_df(struct VERTEX *vertex);

#endif
