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

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.

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

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

commented: 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." -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.