Forum
Resources
Mentors
Projects
Entrance Exams
Question Papers
Colleges
Courses
Universities
Schools
Make Money
Members
Bookmarks
Polls
Fresher Jobs
Funny Photos
B.Tech Projects
New Member FAQ
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
S.Yamininagara...
(515)
vindhya
(474)
Nemish
(440)
Last 7 Days
bharath sudar
(8274)
palvir
(5519)
Nitin Bajaj ...
(3029)
more...
Awards & Gifts
Online Exams
Aptitude Questions
General Aptitude Tests
Medical Entrance
Engineering Entrance
Bank Tests
TOEFL & IELTS Questions
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Advertisements
Watch Asianet TV online
Kairali TV in Internet
Surya TV online
Amritha TV Channel
Program for implementation of DEPTH FIRST SEARCH
Posted Date: 14 Dec 2007 Resource Type:
Articles/Knowledge Sharing
Category:
Education
Posted By:
Jagadeesan. D
Member Level:
Silver
Rating:
Points
: 2
#include
#include
#include
int visited[10],n;
class graph
{
int a[10][10];
public:
void initialise();
void searchform(int k);
};
void graph:: initialise()
{
cout<<"Enter the number of Nodes:";
cin>>n;
cout<<" \nEnter the adjacency Matrix:\n";
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(i!=j)
{
cout<< "\nEnter the value of" <<" "<< i<<" "<< j << " element:";
cin>>a[i][j];
}
}
void graph:: searchform(int k)
{
cout<< "---->"<< k;
visited[k]=1;
for(int i=1;i<=n;i++)
{
if(visited[i]==0)
{
if(a[k][i]!=0)
searchform(i);
}
}
}
void main()
{
clrscr();
graph g1;
g1.initialise();
cout<<"Nodes are visited in this order:";
for(int i=1;i<=n;i++)
if(visited[i]==0)
g1.searchform(i);
getch();
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Program for implementation of AVL TREES
Previous Resource:
Program for implementation of MULTI STACK
Return to Discussion Resource Index
Post New Resource
Category:
Education
Post resources and
earn money
!
Related Resources
ECONOMIC IMPORTANCE OF TEAK
Quiz With answers
ANNUNIVERSITY,BE CIVIL ENGINEERING,VIII SEMESTER, CE1451 -ENGINEERING ECONOMICS AND COST ANALYSIS
Computer Networks online text book
Details about Current Meter.
Contact Us
Privacy Policy
Terms Of Use
SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.