在java中实现Graph对象

时间:2015-12-08 11:48:36

标签: java graph breadth-first-search depth-first-search

所以我试图创建一个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);

1 个答案:

答案 0 :(得分:1)

import缺少类缺少

将必需的jars添加到您的类路径并构建