Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.programming > #1282
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!border2.nntp.ams2.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sun, 05 Feb 2012 05:50:30 -0600 |
| From | "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> |
| Newsgroups | comp.lang.c++, comp.programming |
| References | <7b9a51ce-483a-4b45-8024-4eb070a7c894@b4g2000pbi.googlegroups.com> |
| Subject | Re: Attempting to implement "weird" kind of graph |
| Date | Sun, 5 Feb 2012 11:53:01 -0000 |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5512 |
| X-RFC2646 | Format=Flowed; Original |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.5512 |
| Message-ID | <gd6dneoDN7eb8LPSnZ2dnUVZ8gOdnZ2d@bt.com> (permalink) |
| Lines | 68 |
| X-Usenet-Provider | http://www.giganews.com |
| X-AuthenticatedUsername | NoAuthUser |
| X-Trace | sv3-flu2Z7bo7tlxMUhWMToF71PllsThu9pXN8S/+e/HT79BzxrCAvW5oyoxWgrTRxQPrHokf5O2gXuc6U9!eNNipKNjxT7vmyYw4Slq4b1yaXV7fNQYhDwVt/qF1YVcTayaVCNH7IzaucN3vLBH+24Azffk/y4= |
| X-Complaints-To | abuse@btinternet.com |
| X-DMCA-Complaints-To | abuse@btinternet.com |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 3815 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:13766 comp.programming:1282 |
Cross-posted to 2 groups.
Show key headers only | View raw
mike3 wrote:
> I've been attempting to write a program in C++ that implements the
> “weird kind of graph”
Not too hopeful that this'll help, but here goes anyway...
I get the impression that you're all snarled-up in the mechanics of C++
programming, rather than thinking about the objects/roles/operations that are
appropriate to your target domain. If you start talking about "constructors",
"destructors", "iterators", before you've really decided what your objects are
going to /do/ then I think that's a bad sign -- you are thinking about how you
are going to represent something in a concrete (and pretty lame) language, C++,
before you've thought about /what/ you want to represent.
I haven't really followed the ins and outs of your discussion on this thread,
and in the original one of c.l.c++, but it seems to me that you have:
A Graph (aka Web)
which is made of Strings
each of which is made of a sequence of Nodes.
Strings connect to other Strings at a Node.
Each node is part of exactly one String and has a well-defined position
(index) on that String.
Each String has exactly two endpoints which are nodes on other Strings.
Some questions:
Can Strings be of zero length (ie no "internal" nodes, just the endpoints
which are on other Strings)?
Do you need to associate data with the fact that one string terminates in
another one?
Do you need to associate data with the fact that two "internal" nodes are
adjacent on their owining String?
If you delete a node which is the endpoint of a String, what happens to
that String.
More generally, do you need to modify the structure once it has been
created ?
Do you need "fast" graph-theoretic operations (mu guess would be no).
And so on and so on...
Regardless of the specific answers to the questions, there is a
straight-forward data-structure here (or if may become complicated if you have
stringent performance constraints). So my ultimate question is "why not
program it like that ?" No "node ID's", no "node indexes" (unless your domain
needs them -- which I doubt). Represent Graphs by instances of class Graph,
Strings by instances of class String (in some non-std namespace ;-), and Nodes
by instances of class Node...
-- chris
P.S. My "pretty lame" comment is not intended as a troll for the readers on
c.l.c++ -- which I have only just noticed that this is cross-posted to -- but
is the sincere, and relevant, opionon of a reader of the language-agnostic
group comp.programming.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
Attempting to implement "weird" kind of graph mike3 <mike4ty4@yahoo.com> - 2012-01-24 18:21 -0800
Re: Attempting to implement "weird" kind of graph mike3 <mike4ty4@yahoo.com> - 2012-01-31 01:38 -0800
Re: Attempting to implement "weird" kind of graph Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-31 12:47 +0000
Re: Attempting to implement "weird" kind of graph mike3 <mike4ty4@yahoo.com> - 2012-01-31 13:46 -0800
Re: Attempting to implement "weird" kind of graph "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-02-05 11:53 +0000
Re: Attempting to implement "weird" kind of graph mike3 <mike4ty4@yahoo.com> - 2012-02-07 15:52 -0800
csiph-web