1\par 2\section{Prototypes and descriptions of {\tt MSMDinfo} methods} 3\label{section:MSMDinfo:proto} 4\par 5This section contains brief descriptions including prototypes 6of all methods that belong to the {\tt MSMDinfo} object. 7\par 8\subsection{Basic methods} 9\label{subsection:MSMDinfo:proto:basics} 10\par 11As usual, there are four basic methods to support object creation, 12setting default fields, clearing any allocated data, and free'ing 13the object. 14\par 15%======================================================================= 16\begin{enumerate} 17%----------------------------------------------------------------------- 18\item 19\begin{verbatim} 20MSMDinfo * MSMDinfo_new ( void ) ; 21\end{verbatim} 22\index{MSMDinfo_new@{\tt MSMDinfo\_new()}} 23This method simply allocates storage for the {\tt MSMDinfo} structure 24and then sets the default fields by a call to 25{\tt MSMDinfo\_setDefaultFields()}. 26%----------------------------------------------------------------------- 27\item 28\begin{verbatim} 29void MSMDinfo_setDefaultFields ( MSMDinfo *info ) ; 30\end{verbatim} 31\index{MSMDinfo_setDefaultFields@{\tt MSMDinfo\_setDefaultFields()}} 32This method sets the structure's fields to default values. 33\par \noindent {\it Error checking:} 34If {\tt info} is {\tt NULL}, 35an error message is printed and the program exits. 36%----------------------------------------------------------------------- 37\item 38\begin{verbatim} 39void MSMDinfo_clearData ( MSMDinfo *info ) ; 40\end{verbatim} 41\index{MSMDinfo_clearData@{\tt MSMDinfo\_clearData()}} 42This method clears any data owned by the object 43and then sets the structure's default fields 44with a call to {\tt MSMDinfo\_setDefaultFields()}. 45\par \noindent {\it Error checking:} 46If {\tt info} is {\tt NULL}, 47an error message is printed and the program exits. 48%----------------------------------------------------------------------- 49\item 50\begin{verbatim} 51void MSMDinfo_free ( MSMDinfo *info ) ; 52\end{verbatim} 53\index{MSMDinfo_free@{\tt MSMDinfo\_free()}} 54This method releases any storage by a call to 55{\tt MSMDinfo\_clearData()} then free's the storage for the 56structure with a call to {\tt free()}. 57\par \noindent {\it Error checking:} 58If {\tt info} is {\tt NULL}, 59an error message is printed and the program exits. 60\end{enumerate} 61%----------------------------------------------------------------------- 62\par 63\subsection{Utility methods} 64\label{subsection:MSMDinfo:proto:utility} 65\par 66There are two utility methods, one to print the object, one to 67check to see if it is valid. 68\par 69\begin{enumerate} 70\item 71\begin{verbatim} 72void MSMDinfo_print ( MSMDinfo *info, FILE *fp ) ; 73\end{verbatim} 74\index{MSMDinfo_print@{\tt MSMDinfo\_print()}} 75This method prints out the information to a file. 76\par \noindent {\it Error checking:} 77If {\tt info} or {\tt fp} is {\tt NULL}, 78an error message is printed and the program exits. 79%----------------------------------------------------------------------- 80\item 81\begin{verbatim} 82int MSMDinfo_isValid ( MSMDinfo *info ) ; 83\end{verbatim} 84\index{MSMDinfo_isValid@{\tt MSMDinfo\_isValid()}} 85This method checks that the object is valid. 86The return value is {\tt 1} for a valid object, 87{\tt 0} for an invalid object. 88\par \noindent {\it Error checking:} 89If {\tt info} is {\tt NULL}, 90an error message is printed and the program exits. 91%----------------------------------------------------------------------- 92\end{enumerate} 93%======================================================================= 94\par 95\section{Prototypes and descriptions of {\tt MSMD} methods} 96\label{section:MSMD:proto} 97\par 98This section contains brief descriptions including prototypes 99of all methods that belong to the {\tt MSMD} object. 100The methods are loosely classified as {\it public} and {\it private}. 101Since the C language does not support private methods (with the 102exception of {\tt static} methods within a file), 103specifying a method as public or private is advisory. 104\par 105\subsection{Basic methods --- public} 106\label{subsection:MSMD:proto:basics} 107\par 108As usual, there are four basic methods to support object creation, 109setting default fields, clearing any allocated data, and free'ing 110the object. 111\par 112%======================================================================= 113\begin{enumerate} 114%----------------------------------------------------------------------- 115\item 116\begin{verbatim} 117MSMD * MSMD_new ( void ) ; 118\end{verbatim} 119\index{MSMD_new@{\tt MSMD\_new()}} 120This method simply allocates storage for the {\tt MSMD} structure 121and then sets the default fields by a call to 122{\tt MSMD\_setDefaultFields()}. 123%----------------------------------------------------------------------- 124\item 125\begin{verbatim} 126void MSMD_setDefaultFields ( MSMD *msmd ) ; 127\end{verbatim} 128\index{MSMD_setDefaultFields@{\tt MSMD\_setDefaultFields()}} 129This method sets the structure's fields to default values. 130\par \noindent {\it Error checking:} 131If {\tt msmd} is {\tt NULL}, 132an error message is printed and the program exits. 133%----------------------------------------------------------------------- 134\item 135\begin{verbatim} 136void MSMD_clearData ( MSMD *msmd ) ; 137\end{verbatim} 138\index{MSMD_clearData@{\tt MSMD\_clearData()}} 139This method clears any data owned by the object, 140then sets the structure's default fields 141with a call to {\tt MSMD\_setDefaultFields()}. 142\par \noindent {\it Error checking:} 143If {\tt msmd} is {\tt NULL}, 144an error message is printed and the program exits. 145%----------------------------------------------------------------------- 146\item 147\begin{verbatim} 148void MSMD_free ( MSMD *msmd ) ; 149\end{verbatim} 150\index{MSMD_free@{\tt MSMD\_free()}} 151This method releases any storage by a call to 152{\tt MSMD\_clearData()} then free's the storage for the 153structure with a call to {\tt free()}. 154\par \noindent {\it Error checking:} 155If {\tt msmd} is {\tt NULL}, 156an error message is printed and the program exits. 157\end{enumerate} 158%======================================================================= 159\par 160\subsection{Initialization methods --- public} 161\label{subsection:MSMD:proto:init} 162\par 163There is one initialization method. 164\par 165\begin{enumerate} 166\item 167\begin{verbatim} 168void MSMD_init ( MSMD *msmd, Graph *graph, int stages[], MSMD *info ) ; 169\end{verbatim} 170\index{MSMD_init@{\tt MSMD\_init()}} 171This method initializes the {\tt MSMD} object prior to an ordering. 172It is called by {\tt MSMD\_order()} method, and so it is currently 173a {\it private} method for the object. 174However, when designing more complicated ordering methods, this 175object is necessary to set up the data structures. 176There are two input arguments: 177{\tt graph} is a pointer to a {\tt Graph} object that holds the 178adjacency lists and weights of the vertices, 179and {\tt stages} is a map from each 180vertex to the stage at which it is to be eliminated. 181(If {\tt stages == NULL}, then all vertices will be eliminated in 182one stage, i.e., we order the graph using minimum degree.) 183Unlike much other ordering software, we do {\bf not} destroy the 184adjacency structure of the graph --- however we might shuffle the 185entries in each adjacency list. 186\par \noindent {\it Error checking:} 187If {\tt msmd}, {\tt graph} or {\tt info} is {\tt NULL}, 188an error message is printed and the program exits. 189%----------------------------------------------------------------------- 190\end{enumerate} 191%======================================================================= 192\par 193\subsection{Ordering methods --- public} 194\label{subsection:MSMD:proto:order} 195\par 196There is currently one ordering method. 197\par 198\begin{enumerate} 199\item 200\begin{verbatim} 201void MSMD_order ( MSMD *msmd, Graph *graph, int stages[], MSMD *info ) ; 202\end{verbatim} 203\index{MSMD_order@{\tt MSMD\_order()}} 204This method orders the vertices in the graph and maintains the {\tt 205MSMDvtx} objects in a suitable representation to generate 206permutation vectors and/or a front tree. 207The input is the same as for the {\tt MSMD\_init()} method defined 208above. 209\par 210The method first checks that the input is valid, i.e., that {\tt 211msmd}, {\tt graph} and {\tt info} are not {\tt NULL} and that the 212{\tt info} structure is valid by calling {\tt MSMD\_isValid()}. 213The {\tt msmd} is then initialized by calling {\tt MSMD\_init()}. 214If called for, the graph is compressed prior to any elimination. 215The vertices are then eliminated by their stages via calls to 216{\tt MSMD\_eliminateStage()}. 217The overall statistics for the elimination are then computed, 218and then the working storage is then released, save for the {\tt 219MSMDvtx} structures. 220\par \noindent {\it Error checking:} 221If {\tt msmd}, {\tt graph} or {\tt info} is {\tt NULL}, 222an error message is printed and the program exits. 223\end{enumerate} 224%======================================================================= 225\par 226\subsection{Extraction methods --- public} 227\label{subsection:MSMD:proto:extraction} 228\par 229There are two methods to extract the ordering. 230The first fills one or two {\tt IV} objects with the permutation 231vector(s). 232The second returns an {\tt ETree} object that holds the front tree 233for the ordering. 234\par 235\begin{enumerate} 236%----------------------------------------------------------------------- 237\item 238\begin{verbatim} 239void MSMD_fillPerms ( MSMD *msmd, IV *newToOldIV, IV *oldToNewIV ) ; 240\end{verbatim} 241\index{MSMD_fillPerms@{\tt MSMD\_fillPerms()}} 242If {\tt newToOldIV} is not {\tt NULL}, this method fills the {\tt 243IV} object with the new-to-old permutation of the vertices, 244resizing the {\tt IV} object if necessary. 245If {\tt oldToNewIV} is not {\tt NULL}, this method fills the {\tt 246IV} object with the old-to-new permutation of the vertices, 247resizing the {\tt IV} object if necessary. 248\par \noindent {\it Error checking:} 249If {\tt msmd} is {\tt NULL}, 250or if {\tt newToOldIV} and {\tt oldToNewIV} is {\tt NULL}, 251an error message is printed and the program exits. 252%----------------------------------------------------------------------- 253\item 254\begin{verbatim} 255ETree * MSMD_frontETree ( MSMD *msmd ) ; 256\end{verbatim} 257\index{MSMD_frontETree@{\tt MSMD\_frontETree()}} 258This method constructs and returns a {\tt ETree} object that 259contains the front tree for the ordering. 260\par \noindent {\it Error checking:} 261If {\tt msmd} is {\tt NULL}, 262an error message is printed and the program exits. 263%----------------------------------------------------------------------- 264\end{enumerate} 265%======================================================================= 266\par 267\subsection{Internal methods --- private} 268\label{subsection:MSMD:proto:private} 269\par 270The following methods are used internally to order the graph. 271the user should never have any cause to call them. 272\par 273\begin{enumerate} 274%----------------------------------------------------------------------- 275\item 276\begin{verbatim} 277void MSMD_eliminateStage ( MSMD *msmd, MSMD *info ) ; 278\end{verbatim} 279\index{MSMD_eliminateStage@{\tt MSMD\_eliminateStage()}} 280This method eliminates the vertices in the present stage. 281\par \noindent {\it Error checking:} 282If {\tt msmd} or {\tt info} is {\tt NULL}, 283an error message is printed and the program exits. 284%----------------------------------------------------------------------- 285\item 286\begin{verbatim} 287int MSMD_eliminateStep ( MSMD *msmd, MSMD *info ) ; 288\end{verbatim} 289\index{MSMD_eliminateStep@{\tt MSMD\_eliminateStep()}} 290This method eliminates one {\it step} of vertices, an independent 291set of vertices. 292The return value is the weight of the vertices eliminated at this 293step. 294\par \noindent {\it Error checking:} 295If {\tt msmd} or {\tt info} is {\tt NULL}, 296an error message is printed and the program exits. 297%----------------------------------------------------------------------- 298\item 299\begin{verbatim} 300void MSMD_eliminateVtx ( MSMD *msmd, MSMDvtx *v, MSMD *info ) ; 301\end{verbatim} 302\index{MSMD_eliminateVtx@{\tt MSMD\_eliminateVtx()}} 303This method eliminates vertex {\tt v}. 304\par \noindent {\it Error checking:} 305If {\tt msmd}, {\tt v} or {\tt info} is {\tt NULL}, 306an error message is printed and the program exits. 307%----------------------------------------------------------------------- 308\item 309\begin{verbatim} 310void MSMD_findInodes ( MSMD *msmd, MSMD *info ) ; 311\end{verbatim} 312\index{MSMD_findInodes@{\tt MSMD\_findInodes()}} 313This method examines nodes in the reach set to detect 314indistinguishability. 315\begin{itemize} 316\item 317If {\tt info->compressFlag \% 4 == 0}, there is a simple return. 318\item 319If {\tt info->compressFlag \% 4 == 1}, only 2-adjacent nodes are 320examined. 321\item 322If {\tt info->compressFlag \% 4 == 2}, all nodes are examined. 323\end{itemize} 324The order of the nodes in the reach set may be permuted, but any 325indistinguishable nodes in the reach set are not purged from the 326reach set. 327\par \noindent {\it Error checking:} 328If {\tt msmd} or {\tt info} is {\tt NULL}, 329an error message is printed and the program exits. 330%----------------------------------------------------------------------- 331\item 332\begin{verbatim} 333void MSMD_cleanReachSet ( MSMD *msmd, MSMD *info ) ; 334\end{verbatim} 335\index{MSMD_cleanReachSet@{\tt MSMD\_cleanReachSet()}} 336This method cleans the nodes in the reach set by calling 337{\tt MSMD\_cleanSubtreeList()} 338and {\tt MSMD\_clearEdgeList()}. 339\par \noindent {\it Error checking:} 340If {\tt msmd} or {\tt info} is {\tt NULL}, 341an error message is printed and the program exits. 342%----------------------------------------------------------------------- 343\item 344\begin{verbatim} 345void MSMD_cleanSubtreeList ( MSMD *msmd, MSMDvtx *v, MSMD *info ) ; 346\end{verbatim} 347\index{MSMD_cleanSubtreeList@{\tt MSMD\_cleanSubtreeList()}} 348This method cleans the list of subtrees for vertex {\tt v}, 349removing any node which is no longer the root of a subtree of 350eliminated nodes. 351\par \noindent {\it Error checking:} 352If {\tt msmd}, {\tt v} or {\tt info} is {\tt NULL}, 353an error message is printed and the program exits. 354%----------------------------------------------------------------------- 355\item 356\begin{verbatim} 357void MSMD_cleanEdgeList ( MSMD *msmd, MSMDvtx *v, MSMD *info ) ; 358\end{verbatim} 359\index{MSMD_cleanEdgeList@{\tt MSMD\_cleanEdgeList()}} 360This method cleans the list of uncovered edges for vertex {\tt v}, 361removing any edge {\tt (v,w)} where {\tt v} and {\tt w} share a 362common adjacent subtree. 363\par \noindent {\it Error checking:} 364If {\tt msmd}, {\tt v} or {\tt info} is {\tt NULL}, 365an error message is printed and the program exits. 366%----------------------------------------------------------------------- 367\item 368\begin{verbatim} 369void MSMD_update ( MSMD *msmd, MSMD *info ) ; 370\end{verbatim} 371\index{MSMD_update@{\tt MSMD\_update()}} 372This method updates the priorities of all nodes in the reach set. 373\par \noindent {\it Error checking:} 374If {\tt msmd} or {\tt info} is {\tt NULL}, 375an error message is printed and the program exits. 376%----------------------------------------------------------------------- 377\item 378\begin{verbatim} 379int MSMD_exactDegree2 ( MSMD *msmd, MSMDvtx *v, MSMD *info ) ; 380\end{verbatim} 381\index{MSMD_exactDegree2@{\tt MSMD\_exactDegree2()}} 382This method computes and returns the exact external degree 383for vertex {\tt v}. 384\par \noindent {\it Error checking:} 385If {\tt msmd}, {\tt v} or {\tt info} is {\tt NULL}, 386an error message is printed and the program exits. 387%----------------------------------------------------------------------- 388\item 389\begin{verbatim} 390int MSMD_exactDegree3 ( MSMD *msmd, MSMDvtx *v, MSMD *info ) ; 391\end{verbatim} 392\index{MSMD_exactDegree3@{\tt MSMD\_exactDegree3()}} 393This method computes and returns the exact external degree 394for vertex {\tt v}. 395\par \noindent {\it Error checking:} 396If {\tt msmd}, {\tt v} or {\tt info} is {\tt NULL}, 397an error message is printed and the program exits. 398%----------------------------------------------------------------------- 399\item 400\begin{verbatim} 401int MSMD_approxDegree ( MSMD *msmd, MSMDvtx *v, MSMD *info ) ; 402\end{verbatim} 403\index{MSMD_approxDegree@{\tt MSMD\_approxDegree()}} 404This method computes and returns the approximate external degree 405for vertex {\tt v}. 406\par \noindent {\it Error checking:} 407If {\tt msmd}, {\tt v} or {\tt info} is {\tt NULL}, 408an error message is printed and the program exits. 409%----------------------------------------------------------------------- 410\item 411\begin{verbatim} 412void MSMD_makeSchurComplement ( MSMD *msmd, Graph *schurGraph, IV *VtoPhiIV ) ; 413\end{verbatim} 414\index{MSMD_makeSchurComplement@{\tt MSMD\_makeSchurComplement()}} 415This method fills {\tt schurGraph} with the graph of the Schur 416complement matrix (the fill graph of the uneliminated vertices) 417and fills {\tt VtoPhiIV} with a map from the vertices of the 418original graph to the vertices of the Schur complement graph. 419(The mapped value of an eliminated vertex is {\tt -1}.) 420\par \noindent {\it Error checking:} 421If {\tt msmd}, {\tt schurGraph} or {\tt VtoPhiIV} is {\tt NULL}, 422an error message is printed and the program exits. 423%----------------------------------------------------------------------- 424\end{enumerate} 425\par 426%======================================================================= 427\par 428\section{Prototypes and descriptions of {\tt MSMDvtx} methods} 429\label{section:MSMDvtx:proto} 430\par 431The {\tt MSMDvtx} object is private so would not normally be 432accessed by the user. There is one method to print out the object. 433\begin{enumerate} 434%----------------------------------------------------------------------- 435\item 436\begin{verbatim} 437void MSMDvtx_print ( MSMDvtx *v, FILE *fp ) ; 438\end{verbatim} 439\index{MSMDvtx_print@{\tt MSMDvtx\_print()}} 440This method prints a human-readable representation of a vertex, 441used for debugging. 442\par \noindent {\it Error checking:} 443If {\tt v} or {\tt fp} is {\tt NULL}, 444an error message is printed and the program exits. 445%----------------------------------------------------------------------- 446\end{enumerate} 447%======================================================================= 448