Professional Documents
Culture Documents
TECHNOLOGY
DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
PRESENTATION OF CG PROJECT
DEPTH FIRST SEARCH ALGORITHM
Under the guidance of: Submitted by:
PROF. ADITI ASHOK KATTI SPOORTHI.P RANJANI.R
Dept. of CSE (1AT17CS087) (1AT17CS062)
Atria institute of technology
B.Tech , VI Sem ,CSE
Atria institute of technology
CONTENTS OF PRESENTATION
1. INTRODUCTION
2. PROPOSED PROJECT
3. ADVANTAGES/HIGHLIGHTS
4. REQUIREMENTS ANALYSIS
5. DESIGN
6. DEMO
7. CONCLUSION
8. FUTURE ENHANCEMENTS
INTRODUCTION
ABOUT DPETH FIRST SEARCH ALGORITHM
• Depth First Search (DFS) algorithm traverses a graph in a depthward
motion and uses a stack to remember to get the next vertex to start a
search, when a dead end occurs in any iteration
As in the example given above, DFS algorithm traverses from S to A to D to G
to E to B first, then to F and lastly to C. It employs the following rules.
1.
4. Visit D and mark it as
visited and put onto the
stack. Here, we
have B and C nodes, which
are adjacent to D and both
are unvisited. However, we
shall again choose in an
alphabetical order.
5. We choose B, mark it as
visited and put onto the
stack. Here B does not
have any unvisited
adjacent node. So, we
pop B from the stack.
6. We check the stack top for
return to the previous node
and check if it has any
unvisited nodes. Here, we
find D to be on the top of
the stack.
As C does not have any unvisited adjacent node so we keep popping the
stack until we find a node that has an unvisited adjacent node. In this case,
there's none and we keep popping until the stack is empty.
What is the purpose of depth first search?
• like Breadth First Search, is to visit every node of a graph and collect
some sort of information about how that node was discovered
• DFS can be used on both undirected and directed graphs. What makes
DFS different from BFS is both the method used to discover the
nodes, and the information recorded about that node.
• Instead of radiating outward from the source node (as in BFS), a DFS
explores a single route at a time. Once a "path" has been fully
discovered, DFS backtracks and searches another path. This process is
continued until all possible paths have been exhausted.
Advantages of depth first search
• DFS consumes very less memory space
• It will reach at the goal node in a less time period than BFS if it
traverses in a right path.
glutInit(&argc, char **argv): glutinit will initialize the GLUT library and negotitate a session
with the window system.During this process,glutInit may cause the termination of the GLUT
program with an error message to the user if GLUT cannot be properly initialized.
glutInitDisplayMode(unsigned int mode) : the initial display mode is used when creating top
level windows, sub windows , and overlays to determine the OpenGL display mode for the
to- becreated window or overlay.
glClearColor(R,G,B,A): glVClearColor specifies the red green blue and alpha values used by
glClear to clear the color buffers. Values specified by glClearColor are clamped to the range 0
to 1.
glutMouseFunc(void (*func)(int button, int state, int x, int y)): glutMouseFunc sets the
mouse callback for the current window. When a user preses and releases mouse buttons in
the window, each press and each release generates a mouse callback.The button parameter
is one of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, or GLUT_RIGHT_BUTTON.
Description of User-defined functions
void drawstring(float x, float y, float z , char *string): used to
display text.
setFont():
Void setFont(void *font)
{
/* sets the current font*/
}
DEMO
CONCLUSION
• The project has been successfully implemented by using
openGL
• The project gives the detail of how the nodes are traversed
and order in which they are traversed
• This project provides the visual representation of graph and
the nodes and operations being performed on them
FUTURE ENHANCEMENTS
• The traversing of the node can be shown through dotted lines
• The stack representation can be done for this