小编JvK*_*K92的帖子

符号定向图使用来自文本文件的数据

我很困惑,我非常感谢一些帮助.我目前正在学习算法,但我不知道从哪里开始.

我最近得到了代码(我们只是真的完成了理论,所以看到代码让我害怕我的核心)我已经被赋予了修改这段代码的任务,从文本文件中获取细节并将其放在图表中.文本文件与此类似.

Trout is-a fish
Fish has gills
Fish has fins
Fish is food
Fish is-an animal
Run Code Online (Sandbox Code Playgroud)

在那里还有更多.我只是想知道.我怎么开始这整件事?我有一百万个问题要问,但是如果我知道如何使用文本文件分配顶点,我觉得我可以解决这些问题?我提供的代码和必须编辑的代码如下.任何帮助都会很棒,如果你愿意,只需向正确的方向努力.

(另外,在addEdge类中,重要的是什么?我知道它是遍历边缘的"成本",但我如何分配权重?)

谢谢!

public class Graph {
    private final int MAX_VERTS = 20;
    private final int INFINITY = 1000000;
    private Vertex vertexList[]; // list of vertices
    private int adjMat[][]; // adjacency matrix
    private int nVerts; // current number of vertices
    private int nTree; // number of verts in tree
    private DistPar sPath[]; // array for shortest-path data
    private int currentVert; // current vertex …
Run Code Online (Sandbox Code Playgroud)

java algorithm directed-graph std

6
推荐指数
1
解决办法
426
查看次数

标签 统计

algorithm ×1

directed-graph ×1

java ×1

std ×1