Matrix graph.....

I dont know how to enter graphs image

i uploaded the graph image on photobucet, heres the link:

<a href="http://s1279.photobucket.com/user/searchneverend1/media/graph_zps70e276ff.jpg.html" target="_blank"><img src="http://i1279.photobucket.com/albums/y521/searchneverend1/graph_zps70e276ff.jpg" border="0" alt=" photo graph_zps70e276ff.jpg"/></a>



Using the above graph, find the following (no programming needed):

Find the adjacency matrix of the graph.
Draw the adjacency list of the graph.
List the nodes of the graph in a depth first traversal.
List the nodes of the graph in a breadth first traversal.



Adjacency matrix:

0 1 1 1 0 0

0 0 0 0 1 0

0 1 0 0 1 0

0 0 0 0 0 0

0 0 0 0 0 0

0 1 0 1 0 0


Adjacency list:

0 -> 1,2

1 -> 4

2 -> 1,4

3 -> -

4 -> -

5 -> 1,3


dfs:

0,1,4,2,3

bfs:

0,1,2,3,4


Just wanna know if i did this correct or should i restart. thanks
Last edited on
Topic archived. No new replies allowed.