Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #8200

Re: Breadth first search or depth first search?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From David Brown <david.brown@hesbynett.no>
Newsgroups comp.programming
Subject Re: Breadth first search or depth first search?
Date Mon, 11 Dec 2017 11:17:31 +0100
Organization A noiseless patient Spider
Lines 17
Message-ID <p0llvs$179$1@dont-email.me> (permalink)
References <p0kpcd$r18$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Date Mon, 11 Dec 2017 10:17:32 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="cc99a935933ffa6cba5f3affd7e2160e"; logging-data="1257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6xQWTh+6UCMD03e7spfT9KpN2uI7CzsQ="
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To <p0kpcd$r18$1@gioia.aioe.org>
Cancel-Lock sha1:jHV9j9ACzEstmHyz3g7DK0MfG6g=
Xref csiph.com comp.programming:8200

Show key headers only | View raw


On 11/12/17 03:09, Victor Porton wrote:
> Small graph, need to check if two given nodes are connected.
> 
> Breadth first search or depth first search? (which of two is better?)
> 

If the graph is small, it will not make much difference.  It normally
makes most difference when you have cache effects, or want to limit
recursion depth, or want to avoid more advanced data structures, or have
trees/graphs of a particular shape, or know a bit about where you are
most likely to find a result.  None of that typically matters for a
small graph - use whatever makes it easier to write correct and clear code.


> Or incidence matrix?
> 

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Breadth first search or depth first search? Victor Porton <porton@narod.ru> - 2017-12-11 04:09 +0200
  Re: Breadth first search or depth first search? David Brown <david.brown@hesbynett.no> - 2017-12-11 11:17 +0100
  Re: Breadth first search or depth first search? Öö Tiib <ootiib@hot.ee> - 2017-12-11 14:30 -0800
    Re: Breadth first search or depth first search? Victor Porton <porton@narod.ru> - 2017-12-12 11:16 +0200
      Re: Breadth first search or depth first search? Öö Tiib <ootiib@hot.ee> - 2017-12-13 21:02 -0800

csiph-web