model_server/edge/src/constr_topsort.cxx
/*
 * ConstrTopSort
 *      Does a topological sort of the graph
 *      regarding constraints in the corresponding layout V_direction.
 *      Some nodes are flexible as to what level they are assigned to.
 */
ConstrTopSort
Does a topological sort of the graph
regarding constraints in the corresponding layout V_direction.
Some nodes are flexible as to what level they are assigned to.
ConstrTopSort Does a topological sort of the graph regarding constraints in the corresponding layout V_direction . Some nodes are flexible as to what level they are assigned to .
void ConstrTopSort(graph* g)
{
  if ((g->getorientation() == top_to_bottom) || 
      (g->getorientation() == bottom_to_top)) {
    V_direction = Y;
    H_direction = X;
  }
  else {
    V_direction = X;
    H_direction = Y;
  }
  for (edge* e = g->getheadedge(); e; e = e->getnextedge()) {
    if ((! e->isreversed())) {
      g->constraints->smaller(LAYOUT_TEMP, V_direction, e->getsource(),
			      e->gettarget(), DO, LAYOUT_TEMP_PRI);
    }
  }
  int timestart = (int) time(0);
  g->constraints->consistency();
  int timeend = (int) time (0);
  if (debug) msg("topsort took $1 seconds") << timeend - timestart << eom;
   for (node* n = g->getheadnode(); n; n = n->getnextnode())
        n->setreached(1);
   g->setmaxlevel(0);
}
void ConstrTopSort ( graph * g ) { if ( ( g -> getorientation ( ) == top_to_bottom ) || ( g -> getorientation ( ) == bottom_to_top ) ) { V_direction = Y ; H_direction = X ; } else { V_direction = X ; H_direction = Y ; } for ( edge * e = g -> getheadedge ( ) ; e ; e = e -> getnextedge ( ) ) { if ( ( ! e -> isreversed ( ) ) ) { g -> constraints -> smaller ( LAYOUT_TEMP , V_direction , e -> getsource ( ) , e -> gettarget ( ) , DO , LAYOUT_TEMP_PRI ) ; } } int timestart = ( int ) time ( 0 ) ; g -> constraints -> consistency ( ) ; int timeend = ( int ) time ( 0 ) ; if ( debug ) msg ( " " ) << timeend - timestart << eom ; for ( node * n = g -> getheadnode ( ) ; n ; n = n -> getnextnode ( ) ) n -> setreached ( 1 ) ; g -> setmaxlevel ( 0 ) ; }
ConstrTopSort
      Does a topological sort of the graph
      regarding constraints in the corresponding layout V_direction.
ConstrTopSort Does a topological sort of the graph regarding constraints in the corresponding layout V_direction .
// insert for each edge which is visible and not reversed  // an order constraint into the constraint network; // let the constraint manager do the rest; // assign nodes the level numbers; //   Levels already set by constructor which uses VIEW levels; //   mark nodes as being reached