Nebbyyy
Nebbyyy

Reputation: 358

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

Upvotes: 1

Views: 316

Answers (1)

Ankur Singhal
Ankur Singhal

Reputation: 26067

import for class Graph is missing

Add required jars to your classpath and build

Upvotes: 1

Related Questions