1

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);
2
  • you have to import Graph - if it's packed within an external library(jar) you have to add that jar to your class path Commented Dec 8, 2015 at 11:52
  • Ok I thought that might be the problem, I will try that now thanks. Commented Dec 8, 2015 at 11:55

1 Answer 1

1

import for class Graph is missing

Add required jars to your classpath and build

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks all sorted now :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.