因此,我尝试创建DFS和BFS算法,但由于收到错误Graph object cannot be resolved to a type,似乎无法填充图形对象。从Java库导入时,我缺少什么吗?一如既往的感谢您的帮助。

import java.util.*;

public class Maze {


public static void main(String[] args)
{

    Graph myGraph= new Graph(); //  <- error resides here.


myGraph.addconnection(0, 3);
myGraph.addconnection(0, 5);
myGraph.addconnection(1, 4);
myGraph.addconnection(2, 3);
myGraph.addconnection(5, 4);
myGraph.addconnection(5, 7);
myGraph.addconnection(6, 7);
myGraph.addconnection(7, 8);
myGraph.addconnection(8, 9);
myGraph.addconnection(9, 10);
myGraph.addconnection(11, 3);

最佳答案

类Graph的import丢失

将所需的jars添加到您的类路径并进行构建

10-04 11:53