Problem: solve the following Source of SHORTEST DISTANCE path of A,B,C,D,E,F,G.

I already did link the strings of dots of ABCDEFG and made a polygon which is the other objectives, my only problem now is calculating the source of the shortest distance part of A,B,C,D,E,F,G.

Am using net beans. Guys can you please help me? am very much confused.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author User
*/
public class paths{
}
import java.awt.Color;
import java.awt.Graphics;
import java.swing.*;

public class paths
{
private static void main{({String args[]}
{
myFrame g=newFame ()
coor = new int[][]{{300,400},{200,120},{170,50}{80,76}{143,100},{92,130},{55,50},{300,140}};
g.repaint();
}
static class myFrame extends JFrame
{
public myFrame()
{
setDefaultOperation(JFrame.EXIT_ON_CLOSE);
setSize(450,200);
setVisible(true);
}
public void paint(Grapics.g)
{
char a[]=new char[]{'a','b','c','d','e','f','g'};
g.setColor(Color.blue);
for(int i=0;<7;i++)
g.drawLine(coor[o],coor[1],coor[i+1][o],coor[i+1][1]);

for(int x=0;x<8;x++){
g.setColor(Color.RED);
g.fillOval(coor[x][o]-5,coor[x][1]-5,10,10);
g.setColor(Color.BLACK);ra
g.drawCharts(a,x,1 coor[x][o]-5,coor[x][1]-5);
}


Any help would be appreciated much! thank you!

calculating the source of the shortest distance part of A,B,C,D,E,F,G.

Can you define how a distance is measured?
What do the letters A,B,C,D,E,F,G represent?

Please edit your code and wrap it in code tags. Use the [code] icon above the input box.

TPAM - ohhh sorry about that. Wait up. xD Just a newbie here.
Will edit the first post. Any type of measurement would be fine.

It just confuses me, the ABCDEFG is the points on which I used
to link the strings. This has been a pain in the neck. Thanks for the effort of replying sir.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author User
*/
public class paths{
}
import java.awt.Color;
import java.awt.Graphics;
import java.swing.*;

public class paths
{
private static void main{({String args[]}
{
myFrame g=newFame ()
coor = new int[][]{{300,400},{200,120},{170,50}{80,76}{143,100},{92,130},{55,50},{300,140}};
g.repaint();
}
static class myFrame extends JFrame
{
public myFrame()
{
setDefaultOperation(JFrame.EXIT_ON_CLOSE);
setSize(450,200);
setVisible(true);
}
public void paint(Grapics.g)
{
char a[]=new char[]{'a','b','c','d','e','f','g'};
g.setColor(Color.blue);
for(int i=0;<7;i++)
g.drawLine(coor[i][o],coor[i][1],coor[i+1][o],coor[i+1][1]);

for(int x=0;x<8;x++){
g.setColor(Color.RED);
g.fillOval(coor[x][o]-5,coor[x][1]-5,10,10);
g.setColor(Color.BLACK);ra
g.drawCharts(a,x,1 coor[x][o]-5,coor[x][1]-5);
}

Edited 5 Years Ago by wondering_ed: n/a

The code you just posted looks to have the same error as the first post.

Does this code that you posted compile?

Sir I didn't mention that those were the fixed codes.
Please keep calm. I am a newbie. Still fixing the codes and thank you for replying.

to start with, you need to know the distances between your points and to keep track of the distances, you can keep them using the adjacency matrix. however remember that the adjacency matrix consumes memory as it also contains 0 where the is no direct route between points. i don't want to go much in details cause it will confuse you. try to search on how to use an adjacency matrix. it is an algorithm concept of graphs which focus much on vertices(nodes) and edges(lines from one nodes to the other) but i think you need it.

This article has been dead for over six months. Start a new discussion instead.