Re: DAG walking problem

"Keith L. Breinholt" <kbreinho@bsquare.com>
22 Apr 1997 21:23:16 -0400

          From comp.compilers

Related articles
DAG walking problem stevec@pact.srf.ac.uk (1997-04-16)
Re: DAG walking problem kbreinho@bsquare.com (Keith L. Breinholt) (1997-04-22)
| List of all articles for this month |
From: "Keith L. Breinholt" <kbreinho@bsquare.com>
Newsgroups: comp.compilers
Date: 22 Apr 1997 21:23:16 -0400
Organization: bsquare consulting inc.
References: 97-04-092
Keywords: analysis, theory

Stephen Clarke wrote:
> I have a DAG, and I want to visit the vertices in topological order
> (i.e. I can only visit a vertex after I have visited all its
> predecessors). I have to store information with each vertex after I
> visit it, and I can only discard the information after I have visited
> all of its immediate successors. Assuming the space required for this
> information is the same for every vertex, I would like to visit the
> vertices in an order that minimizes the maximum amount of space
> required for the complete walk.
>
> Obviously, depth first order is not the best order on very deep
> graphs, and breadth first ordering is not the best order on very broad
> graphs. I can envisage some kind of priority ordering where I
> prioritize the avialable vertices according to how much info they
> allow me to discard, but it seems there ought to be some more elegant
> solution than this ...


In order to prioritize your graph you would need to scan the graph
first and then pick and store your priorities in some fashion. The
above would require both time and resources. If you want to conserve
on resources you just killed the reason for prioritizing your walk.


Sometimes the simplest approach is the best approach.
--
kbreinho@bsquare.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.