Feature/get distance manyto many
Add getDistances method to the shortestPath class and use it in the DistanceMatrix app.
Edited by Louison Fresnais
Merge request reports
Activity
Filter activity
requested review from @clement.frainay
assigned to @louison.fresnais
266 267 public HashMap<String, E> getMapView() { 267 268 return new HashMap<>(this.entities); 268 269 } 269 270 public Set<E> asSet() { Effectivement ... je n'y avais pas pensé sur le coup :o
Edited by Louison Fresnaischanged this line in version 4 of the diff
406 408 public List<BioPath<V,E>> getAllShortestPaths(){ 407 409 return getShortestPathsUnionList(g.vertexSet()); 408 410 } 409 411 /** 412 * Return the distance matrix of all the paiwise distances in the graph 413 * 414 * @return the distance matrix 415 */ 416 public BioMatrix getDistances(){ changed this line in version 6 of the diff
431 j++; 432 } 433 i++; 434 } 435 //get the label-index matching 436 HashMap<String,Integer> rowLabelMap = distMatrix.getRowLabelMap(); 437 HashMap<String,Integer> columnLabelMap = distMatrix.getColumnLabelMap(); 438 //compute all sps in the graph 439 List<BioPath<V,E>> allShortest = getShortestPathsUnionList(nodeSet); 440 //fill the biomatrix 441 try { 442 for(BioPath bp:allShortest) { 443 distMatrix.set(rowLabelMap.get(bp.getStartVertex().toString()), columnLabelMap.get(bp.getEndVertex().toString()), bp.getLength()); 444 } 445 } catch (NullPointerException e ) { 446 System.err.println("Null pointer exception raised, no BioPath computed"); changed this line in version 6 of the diff
424 distMatrix.setColumnLabel(i,r1.getId()); 425 int j = 0; 426 for(V r2:nodeSet){ 427 //init value in matrix to inf if r1!=r2 428 if(r1!=r2) { 429 distMatrix.set(i, j, Double.POSITIVE_INFINITY); 430 } 431 j++; 432 } 433 i++; 434 } 435 //get the label-index matching 436 HashMap<String,Integer> rowLabelMap = distMatrix.getRowLabelMap(); 437 HashMap<String,Integer> columnLabelMap = distMatrix.getColumnLabelMap(); 438 //compute all sps in the graph 439 List<BioPath<V,E>> allShortest = getShortestPathsUnionList(nodeSet); changed this line in version 6 of the diff
added 1 commit
- 3f7d722f - Rename path to matrix conversion method, handle non-square matrix, add option for weighted case
added 1 commit
- 297166b3 - [fix] DefaultWeightPolicy class renamed UnweightedPolicy.
Please register or sign in to reply