Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 135,958 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,597 people online right now. Registration is fast and FREE... Join Now!




c++ graph traversing

 
Reply to this topicStart new topic

c++ graph traversing

Nirvo
11 May, 2008 - 11:49 PM
Post #1

New D.I.C Head
*

Joined: 20 Feb, 2008
Posts: 8


My Contributions
Hello once again!

First of i have an undirected graph with 10k points and 37k connections.Every point stores what connection it has.
Now my job is to create method which will find 1000, 5000 points connected to each other
without points repeating in my path.At the moment my method can find only 100 points which is far from 5k.


What my method does:
Traverse through points and stores those points in vector so i know which ones i visited.
If i come to a dead end i delete connection second last element in vector and pop last element in vector.
Also i store the dead end point so i dont go to it again.
My method is on laptop so i can post i later if any1 needs to see it.

Now iam looking for some tips to repair this method to find 5k points.
Would it dfs or bfs algorithm be good for such a task ?


User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 09:22AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month