You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Executing the following code, using one of the graph of the examples, raises a NullPointerException when using Bellman-Ford algorithm:
/*******************/
String first = "A";
String goal = "F";
List list = new ArrayList<>();
list.add(new Link("A","B",2));
list.add(new Link("A","C",6));
list.add(new Link("B","C",1));
list.add(new Link("B","D",9));
list.add(new Link("B","F",11));
list.add(new Link("C","E",3));
list.add(new Link("D","F",2));
list.add(new Link("E","D",2));
HashBasedHipsterDirectedGraph g = new HashBasedHipsterDirectedGraph<>();
for(Link l : list)
g.connect(l.getSource(), l.getTarget(), l.getWeight());
SearchProblem p = GraphSearchProblem.startingFrom(first).in(g).takeCostsFromEdges().build();
Algorithm.SearchResult o = Hipster.createBellmanFord(p).search(goal);
/*******************/
Note: "Link" is a simple bean class with "source", "target" and "weight" fields.
Replacing the algorithm with other such as Dijkstra or Breadth, it works fine.
The text was updated successfully, but these errors were encountered:
Executing the following code, using one of the graph of the examples, raises a NullPointerException when using Bellman-Ford algorithm:
/*******************/
String first = "A";
String goal = "F";
List list = new ArrayList<>();
list.add(new Link("A","B",2));
list.add(new Link("A","C",6));
list.add(new Link("B","C",1));
list.add(new Link("B","D",9));
list.add(new Link("B","F",11));
list.add(new Link("C","E",3));
list.add(new Link("D","F",2));
list.add(new Link("E","D",2));
HashBasedHipsterDirectedGraph g = new HashBasedHipsterDirectedGraph<>();
for(Link l : list)
g.connect(l.getSource(), l.getTarget(), l.getWeight());
SearchProblem p = GraphSearchProblem.startingFrom(first).in(g).takeCostsFromEdges().build();
Algorithm.SearchResult o = Hipster.createBellmanFord(p).search(goal);
/*******************/
Note: "Link" is a simple bean class with "source", "target" and "weight" fields.
Replacing the algorithm with other such as Dijkstra or Breadth, it works fine.
The text was updated successfully, but these errors were encountered: