HW5 and Java code about graph

14 views
Skip to first unread message

Haidong (Haydon) Xue

unread,
Jul 9, 2012, 3:27:45 PM7/9/12
to gsu-csc4520...@googlegroups.com
Hi all, 

HW5 has just been posted.

An implementation of adjacency-list and related code are also posted. 

Implementing BFS and DFS for adjacency-matrix is part of HW5. 


--
Haidong(Haydon) Xue
Ph.D Candidate
Research Assistant, Teaching Instructor
Department of Computer Science
Georgia State University

Brian Wells

unread,
Jul 9, 2012, 8:33:30 PM7/9/12
to gsu-csc4520...@googlegroups.com
It appears to me that in the following method in the posted class GraphAdjacencyList should be revised as follows:

@Override
	public void printInfo()
	{
		// vertices
		for( Vertex v : vertices)
		{
			v.printInfo();
			System.out.print(" ");
		}
		System.out.println();
		
		// edges
		for( ArcNode head : adjL )
		{
			for( ArcNode n=head; n!=null; n=n.next)
			{
				head.edge.printInfo();
				System.out.print(" ");
			}	
		}
		System.out.println();
	}

Should be:

@Override
	public void printInfo()
	{
		// vertices
		for( Vertex v : vertices)
		{
			v.printInfo();
			System.out.print(" ");
		}
		System.out.println();
		
		// edges
		for( ArcNode head : adjL )
		{
			for( ArcNode n=head; n!=null; n=n.next)
			{
				n.edge.printInfo();
				System.out.print(" ");
			}	
		}
		System.out.println();
	}
Brian Wells

From: gsu-csc4520...@googlegroups.com [gsu-csc4520...@googlegroups.com] on behalf of Haidong (Haydon) Xue [haido...@gmail.com]
Sent: Monday, July 09, 2012 3:27 PM
To: gsu-csc4520...@googlegroups.com
Subject: HW5 and Java code about graph

Haidong (Haydon) Xue

unread,
Jul 9, 2012, 10:30:12 PM7/9/12
to gsu-csc4520...@googlegroups.com
You are definitely correct. Updated. Thank you. +2
Reply all
Reply to author
Forward
0 new messages