/* This file implements structures for edge and node aux variables. Copyright (C) 2004 The University of Texas at Austin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Email: usman@cs.njit.edu Mail: Usman Roshan, Department of Computer Sciences, NJIT-CCS, Computer Science Department, GITC 4400, University Heights, Newark, NJ 07102 */ #ifndef UGRAPH_AUX_VARS #define UGRAPH_AUX_VARS #include /*! \brief A node_aux_vars is just a pointer to a node_aux_vars_struct */ typedef struct node_aux_vars_struct* node_aux_vars; /*! \brief An edge_aux_vars is just a pointer to an edge_aux_vars_struct */ typedef struct edge_aux_vars_struct* edge_aux_vars; /*! \brief Holds set of auxillary variables assigned to each node. Recall that all nodes in the undirected graph (see ugraph.h) contain a void* to hold any auxillary variables. */ struct node_aux_vars_struct { /*!Each leaf is given a taxon id; this variable is set to -1 for internal nodes.*/ int taxon_id; /*!The taxon id is also stored as a set for later manipulations; this set is empty for internal nodes. */ int_set taxaset; /*! The taxa_size variable contains the number of leaves below a node. This variable helps us to find the centroid edge quickly. Note that the tree is stored in unrooted format, but it is read in as a rooted tree; therefore, the parents and children of a node are determined at that time. The taxa_size variable helps us to find the centroid edge---the algorithm to find the centroid iterates over all nodes and finds the one whose taxa_size is closest to half the number of leaves. */ int taxa_size; }; /*! \brief Holds set of auxillary variables assigned to each edge. All edges in the undirected graph (see ugraph.h) contain a void* to hold any auxillary variables. */ struct edge_aux_vars_struct { /*!Used to store the weight of each edge which is used when computing the separator*/ double wgt; }; /* \brief Create a new node_aux_vars.*/ node_aux_vars new_node_aux_vars(); /* \brief Delete the node_aux_vars n.*/ void del_node_aux_vars(node_aux_vars n); void assign_node_aux_vars(node_aux_vars dest, node_aux_vars src); /* \brief Create a new edge_aux_vars.*/ edge_aux_vars new_edge_aux_vars(); /* \brief Delete the edge_aux_vars n.*/ void del_edge_aux_vars(edge_aux_vars n); void assign_edge_aux_vars(edge_aux_vars dest, edge_aux_vars src); #endif