0

Hi...

I'm trying to study graphs but I cant find a good tutorial on it. I googled it, but couldn't find what I needed.

Can you please suggest me a good tutorial on graphs in c++. I am basically looking for how a graph class is implemented in c++, an dthe functions to add vertexes.

Thanks in advance.
Edit/Delete Message

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Nikhar
0

Hi...

I'm trying to study graphs but I cant find a good tutorial on it. I googled it, but couldn't find what I needed.

Can you please suggest me a good tutorial on graphs in c++. I am basically looking for how a graph class is implemented in c++, an dthe functions to add vertexes.

Thanks in advance.
Edit/Delete Message

Without knowing which compiler/OS you're working on, I can give you only a generic solution like the Boost graph library.

0

depends on what you want to do really... it's easy to implement an adjacency list graph using the STL vector class, if you don't insist on making a special class for it ofc..

vector< int > graph[ MAX_NODES ]; // graph[x] => neighbors of node x

if you need some more info in the nodes, you can make a class for a single
node, or keep arrays of stuff you're interested about for each node ( for example discovery/finish time, if you're working with dfs-trees or some algorithms of that nature ), though i guess that's not the real oop approach :D

-1

Maybe I'll elaborate more. I want to learn graphs so that I can solve algorithms such as shortest path.

OS-> Windows XP

Compiler-> Code::blocks

Comments
To you, this might be very much an illumination on your question. I read it as extremely vague, along the lines of, "I want to learn hammer so I can build apartment complex."
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.