javaalgorithmcompiler-errorstarjans-algorithm

Trying to run the java implementation of Tarjan algorithm


I am trying to run the Tarjan java implementation from wikipedia. My final goal is to inject a few println at specifc points, this will allow me to understand further the code.

What have I done so far

a)Tarjan source code b)Edge source code c)Node source code j in 3 separate files under in the same folder.

What is the concrete problem I am facing I get 3 erros:

Tarjan.java:9: error: cannot find symbol
  public ArrayList<ArrayList<Node>> executeTarjan(AdjacencyList graph){
                                                  ^
  symbol:   class AdjacencyList
  location: class Tarjan
Tarjan.java:28: error: cannot find symbol
   private ArrayList<ArrayList<Node>> tarjan(Node v, AdjacencyList list){
                                                     ^
  symbol:   class AdjacencyList
  location: class Tarjan
Tarjan.java:14: error: cannot find symbol
          List<Node> nodeList = new ArrayList<Node>(graph.getSourceNodeSet());
          ^
  symbol:   class List
  location: class Tarjan
3 errors

The corresponding lines: 9, 28, 14 are these

//line 9
 public ArrayList<ArrayList<Node>> executeTarjan(AdjacencyList graph){
 //line 28
List<Node> nodeList = new ArrayList<Node>(graph.getSourceNodeSet());
//line 14
private ArrayList<ArrayList<Node>> tarjan(Node v, AdjacencyList list){

Additional explanation I did not put as title the kind of error I get because I don't know if this is an actual error or something else I am doing wrong, maybe I have to include the files (like in php..don't know). I am posting this in the hope that making it run is something simple since the code is there already.

Thank you all in advance!


Solution

  • Most likely your missing some imports:

    import java.util.List;
    

    Also, you need to obtain the sourcecode for AdjacencyList from here That should fix your problems with compilation, might run into others later on :)