简体   繁体   中英

Implementing a Graph object in java

So I am attempting to create a DFS and BFS algorithm but cannot seem to get the graph object populated as I receive the error Graph object cannot be resolved to a type . Is there something I am missing when importing from the java library? As always thanks for your help.

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);

import for class Graph is missing

Add required jars to your classpath and build

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM