Question
Asked by:
2000Angie
2000Angie from TCC/RSU
Rating : No Rating
Questions Asked: 12
Tutorials Posted: 0
 

$30.00 Java graphs

Q:
unit 14 2 assignments and a bonus. 1st assignment is Repesenting a graph and the second is Representing a Tree and the bonus is Manipulating a Tree. the bonus is just opptional for me at this point. thanks! attached is the asignment in more detail and the code source the professor prvided.
 
Attachments:
Lab14.doc (278K)
Lab_14_Templates.zip (33K)
Want to take a stab at the bounty and post a tutorial? Need clarification? Join us now or log in! Read more on how this works.
 
Available Tutorials to this Question
Posted by:
DoctorD
DoctorD from UC Berkeley
Rating (6): A-
Questions Asked: 0
Tutorials Posted: 25, earned $350.54
 

$30.00 Generating random graphs on a circle.

  • This tutorial hasn't been purchased yet.
  • Posted on Nov 19, 2008 at 11:34:49PM
A:
Preview: ... int y = (int) (radius * Math.sin(count * 2 * Math.PI / numOfVert));
Construct a Point2D object from x and y.
Call vert.addElement with the new Point2D object.
End Loop

The next part is to draw some edges between a few randomly selected points.
Here's the pseudocode:
Loop count from zero to actualNumberOfEdges
Randomly select a start vertex (v1) and an end vertex (v2):
int v1 = (int) (Math.random()*numOfVert);
int v2 = (int) (Math.random()*numOfVert);
Construct a "non-special" Edge object from v1 to v2.
(Refer to the constructor of the Edge class.)
Call edges.addElement with the new Edge object.
End Loop

When you run the applet,
follow the assignment directions ...

The full tutorial is about 632 words long .
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty