Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24812
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'algorithm': 0.03; 'binary': 0.05; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'visited': 0.09; 'dfs': 0.16; 'dictionaries': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'hashable': 0.16; 'message-id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:mnet-online.de': 0.16; 'received:plane.gmane.org': 0.16; 'solver': 0.16; 'stefan': 0.17; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'tree': 0.27; 'header:X-Complaints-To:1': 0.28; 'record': 0.28; 'depth': 0.29; 'dictionary': 0.29; 'lists': 0.31; 'url:python': 0.32; 'structure': 0.32; 'could': 0.32; 'ordered': 0.33; 'right?': 0.33; 'subject:data': 0.33; 'to:addr:python-list': 0.33; 'built-in': 0.35; 'there': 0.35; 'received:org': 0.36; 'url:org': 0.36; 'totally': 0.36; 'url:library': 0.36; 'does': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'first': 0.61; 'received:93': 0.72; 'bst': 0.84; 'subject:Best': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Stefan Behnel <stefan_ml@behnel.de> |
| Subject | Re: Best data structure for DFS on large graphs |
| Date | Tue, 03 Jul 2012 13:23:58 +0200 |
| References | <CACA+676A=G=3+wvaHw3H0LAo2cghztXo4+9ORR73CXBOOpW0ZQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | ppp-93-104-1-135.dynamic.mnet-online.de |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
| In-Reply-To | <CACA+676A=G=3+wvaHw3H0LAo2cghztXo4+9ORR73CXBOOpW0ZQ@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1738.1341314657.4697.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1341314657 news.xs4all.nl 6848 [2001:888:2000:d::a6]:43453 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:24812 |
Show key headers only | View raw
Miheer Dewaskar, 03.07.2012 13:11: > I want to make a combinatorial game solver in python.The algorithm is to > perform Depth First Search (DFS) on the states of the game. > For DFS I,would need to keep a record of the visited states.What is the > best data structure for it,keeping in mind that the number of states could > be large? > > I was thinking about using Dictionary or a Binary Search Tree (BST) > ,assuming that the states can be made hashable and totally ordered > respectively. > I am not sure,but if there are large number of states Dictionaries wont > help much right? Dicts are fast for lookup, not for searching. > Anyway, does python have a built-in BST like data-structure ? It has lists and bisect: http://docs.python.org/library/bisect.html Stefan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Best data structure for DFS on large graphs Stefan Behnel <stefan_ml@behnel.de> - 2012-07-03 13:23 +0200
csiph-web