J
Jon Slaughter
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
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