def derived_sequence(graph):
 deriv_seq = [graph]
 deriv_interv = []
 single_node = False
 while (not single_node):
  (interv_graph, interv_heads) = intervals(graph)
  deriv_interv.append(interv_heads)
  single_node = (len(interv_graph) == 1)
  if (not single_node):
   deriv_seq.append(interv_graph)
  graph = interv_graph
  graph.compute_rpo()
 return (deriv_seq, deriv_interv)

def derived_sequence ( graph ) : deriv_seq = [ graph ] deriv_interv = [ ] single_node = False while ( not single_node ) : ( interv_graph , interv_heads ) = intervals ( graph ) deriv_interv . append ( interv_heads ) single_node = ( len ( interv_graph ) == 1 ) if ( not single_node ) : deriv_seq . append ( interv_graph ) graph = interv_graph graph . compute_rpo ( ) return ( deriv_seq , deriv_interv )
compute the derived sequence of the graph g the intervals of g are collapsed into nodes .