联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-10-03 10:48

Your program should:

1. Open the text file “ass3.txt”. (Note: “ass3.txt” should be a hardcoded as a constant.)

2. Read a graph from the file.


The data files are constructed as follows:

• Two integers: nVertices and nEdges, the number of vertices and edges in the graph.

• nVertices triples consisting of the label and the x- and y-coordinates of each vertex.

• nEdges triples consisting of the labels of the start and end vertices of each edge, along with its weight. Note: the weight associated with an edge will be greater than or equal to the Euclidean distance between its start and end vertices as determined by their coordinates.

• Two labels, the indicating the start and goal vertices for which the paths are required.


Read the data file into adjacency lists, or an adjacency matrix, and print on the screen the first 5 vertices and the vertices they are connected to together with their weights. e.g.:

a:  c(35)  d(27)  e(48)

b:  d(35)  g(27)

c:  b(125) e(20)  f(56)  h(31)

. . .

Note: The data shown above is for format purposes only.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp