472,133 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Writing a graph

Hi,

I need to write a graph which provides at least the
following functions:

1) stores nodes and edges (both store further information which
can be of any type)
2) manipulations on nodes and edges like delete, add ...
3) provides a list of all successors/predecessors for a given node
4) provides a list of all nodes that can be reached from a given
node on an existing path (sequence of edges)
5) provides a list of all nodes that can reach n on a given path
6) check whether the graph is cyclic

The code should be based on Standard Template Libraries (STL).

How would you realize this task e.g. which structures would you
use?

Are there any STL graph classes which already provides the aforementioned
functions?

If you have or know any self-written graph code and would like to share
just let me know ;)

Thank you very much for your help.

Chris
Jul 23 '05 #1
2 2616
I don't know much about graphs, but did you try boost graph library?
Take a look:

http://www.boost.org/libs/graph/doc/..._contents.html

Hey, I do have a nag at learning mathematical concepts - if you'll be
my tutor, you know my email address ;)

Samee

P.S. Please try to avoid postings to which easy answers exist e.g.
googling with C++ graph library gives the boost library as the very
first result! My first post to this group (just a few days back) was a
similar Q about a regex library, and I was immediately notified of
inappropriate postings (these are often considered OT)

Jul 23 '05 #2

"Christian Christmann" <pl*****@yahoo.de> wrote in message
news:42**********************@newsread2.arcor-online.net...
Hi,

I need to write a graph which provides at least the
following functions:

1) stores nodes and edges (both store further information which
can be of any type)
2) manipulations on nodes and edges like delete, add ...
3) provides a list of all successors/predecessors for a given node
4) provides a list of all nodes that can be reached from a given
node on an existing path (sequence of edges)
5) provides a list of all nodes that can reach n on a given path
6) check whether the graph is cyclic

The code should be based on Standard Template Libraries (STL).

How would you realize this task e.g. which structures would you
use?

Are there any STL graph classes which already provides the aforementioned
functions?

If you have or know any self-written graph code and would like to share
just let me know ;)


Take a look at http://www.boost.org/libs/graph/doc/..._contents.html

Jeff Flinn
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Lilith | last post: by
25 posts views Thread by Magnus Lie Hetland | last post: by
1 post views Thread by entropy123 | 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.