472,144 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,144 software developers and data experts.

Digraph Class

I was thinking of implemented a class that would let you build a an
arbitrary class and was wondering if this as already been done before(I
assume it has, but just wondering).

The basic idea that I'm thinking of is to include a list of pointers to
classes that are the in's and the classes that are outs with a class type
for each edge(which can represent the "edges" value).

Basicaly, call it a node, the node contains a list of pointers to edges. An
edge is a class that points to a the edges "value"(a class type) and the end
of the edge with a direction flag.

After all that then I was thinking to develop some algorithms to
combine/remove nodes and do some computation(find shortest path, etc...).
Ofcourse, I have to worry about cycles and possibly long computational time,
but no big deal at the moment.

Anyways, anyone have any ideas for this? Maybe how I can do this more
efficently and also the most general? my idea right now is basicaly have two
classes node and edge with the node class containing a pointer to a list of
pointers of edges. I'm not sure what I will need to make being able to
compute things the most general though. Like say I have a digraph where each
node represents a part of a string... I need some general algorithms that
will work find if they were numbers(such as probabilities), but not sure if
the node is something more general. What I'm thinking is basically one
would extend the node class to override some computational functions so it
will still work, but I'm then I think that I'm still limiting the
possibilities.

What I want to do is make is the most general it can be, as I've said... so
you could have different "types" of nodes and different "types" of edges.
Like some nodes could be people and others are numbers. Its up to the person
who implements the class to specify how nodes interact through the edges. I
guess what I'm thinking of doing is having the user override the arithmetic
operators and using those to implement things such as shortest path, etc...
(gotta read over some graph there first I suppose).
any ideas?
Jon
Jul 23 '05 #1
2 1943
"Jon Slaughter" <Jo***********@Hotmail.com> wrote...
I was thinking of implemented a class [...]
any ideas?


Have you seen GTL (Graph Template Library)? Or Boost Graph Library?
Jul 23 '05 #2

"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:V5********************@comcast.com...
"Jon Slaughter" <Jo***********@Hotmail.com> wrote...
I was thinking of implemented a class [...]
any ideas?


Have you seen GTL (Graph Template Library)? Or Boost Graph Library?

I haven't, I will search for them.

Thanks.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Murat Tasan | last post: by
2 posts views Thread by Fernando Rodriguez | last post: by
2 posts views Thread by Gabriel Genellina | last post: by
5 posts views Thread by Andy | last post: by
1 post views Thread by MakaMaka | last post: by
3 posts views Thread by Hamilton Woods | last post: by
reply views Thread by emin.shopper | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.