<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Depth First | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/depth-first/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Mon, 31 Jan 2011 12:39:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ programs to implement Graph Traversal Techniques &#8211; Depth First Search/Breadth First Search</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-programs-to-implement-graph-traversal-techniques-depth-first-searchbreadth-first-search/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-programs-to-implement-graph-traversal-techniques-depth-first-searchbreadth-first-search/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 12:38:55 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[Graph Traversal Techniques]]></category>
		<category><![CDATA[Breadth first]]></category>
		<category><![CDATA[Search algorithm]]></category>
		<category><![CDATA[Depth First]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1279</guid>

					<description><![CDATA[<p>a)Program to implement Breadth first Search algorithm. #include #include #include int cost[10][10],i,j,k,n,queue[10],front,rear,v,visit[10],visited[10]; void main() { int m; clrscr(); cout n; cout m; cout >j; cost[i][j]=1; } cout v; cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-programs-to-implement-graph-traversal-techniques-depth-first-searchbreadth-first-search/">C++ programs to implement Graph Traversal Techniques – Depth First Search/Breadth First Search</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>a)Program to implement Breadth first Search algorithm.</strong></p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int cost[10][10],i,j,k,n,queue[10],front,rear,v,visit[10],visited[10];
void main()
{
	int m;
	clrscr();
	cout <<"enterno of vertices";
	cin >> n;
	cout <<"ente no of edges";
	cin >> m;
	cout <<"\nEDGES \n";
	for(k=1;k<=m;k++)
	{
		cin >>i>>j;
		cost[i][j]=1;
	}
	cout <<"enter initial vertex";
	cin >>v;
	cout <<"Visitied vertices\n";
	cout << v;
	visited[v]=1;
	k=1;
	while(k<n)
	{
		for(j=1;j<=n;j++)
			if(cost[v][j]!=0 &#038;&#038; visited[j]!=1 &#038;&#038; visit[j]!=1)
			{
				visit[j]=1;
				queue[rear++]=j;
			}
		v=queue[front++];
		cout<<v << " ";
		k++;
		visit[v]=0;
		visited[v]=1;
	}
	getch();
}
</pre>
<p><strong>b)Program to implement Depth First Search Algorithm.</strong></p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int cost[10][10],i,j,k,n,stack[10],top,v,visit[10],visited[10];
void main()
{
	int m;
	cout <<"enterno of vertices";
	cin >> n;
	cout <<"ente no of edges";
	cin >> m;
	cout <<"\nEDGES \n";
	for(k=1;k<=m;k++)
	{
		cin >>i>>j;
		cost[i][j]=1;
	}
	cout <<"enter initial vertex";
	cin >>v;
	cout <<"ORDER OF VISITED VERTICES";
	cout << v <<" ";
	visited[v]=1;
	k=1;
	while(k<n)
	{
		for(j=n;j>=1;j--)
			if(cost[v][j]!=0 && visited[j]!=1 && visit[j]!=1)
			{
				visit[j]=1;
				stack [top]=j;
				top++;
			}
		v= stack [--top];
		cout<<v << " ";
		k++;
		visit[v]=0; visited[v]=1;
	}
	getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-programs-to-implement-graph-traversal-techniques-depth-first-searchbreadth-first-search/">C++ programs to implement Graph Traversal Techniques – Depth First Search/Breadth First Search</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-programs-to-implement-graph-traversal-techniques-depth-first-searchbreadth-first-search/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
	</channel>
</rss>
