Connecting Tech Pros Worldwide Help | Site Map

Digraph Class

  #1  
Old July 23rd, 2005, 02:58 AM
Jon Slaughter
Guest
 
Posts: n/a
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


  #2  
Old July 23rd, 2005, 02:58 AM
Victor Bazarov
Guest
 
Posts: n/a

re: Digraph Class


"Jon Slaughter" <Jon_Slaughter@Hotmail.com> wrote...[color=blue]
>I was thinking of implemented a class [...]
>
>
> any ideas?[/color]

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


  #3  
Old July 23rd, 2005, 02:58 AM
Jon Slaughter
Guest
 
Posts: n/a

re: Digraph Class



"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:V5idnacEdMz_xq7fRVn-hA@comcast.com...[color=blue]
> "Jon Slaughter" <Jon_Slaughter@Hotmail.com> wrote...[color=green]
>>I was thinking of implemented a class [...]
>>
>>
>> any ideas?[/color]
>
> Have you seen GTL (Graph Template Library)? Or Boost Graph Library?[/color]


I haven't, I will search for them.

Thanks.


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
template template arguments: expected a class template, got `Component<T1, T2, T3> gary.bernstein@gmail.com answers 1 June 8th, 2007 08:25 AM
Graph Data Structures Nathan Harmston answers 12 November 26th, 2006 04:25 AM
Python module for making org charts? Paul Gardella answers 4 July 18th, 2005 04:41 AM
Selecting elements from a list Martin Christensen answers 9 July 18th, 2005 03:18 AM