use of org.jgrapht.graph.DefaultEdge in project jstructure by JonStargaryen.
the class ResidueGraphCalculations method shortestPathsPassingThrough.
/**
* Determines the set of shortest paths passing through 1 particular edge.
* @param contact
* @return
*/
private List<GraphPath<AminoAcid, DefaultEdge>> shortestPathsPassingThrough(Pair<AminoAcid, AminoAcid> contact) {
AminoAcid aminoAcid1 = contact.getLeft();
AminoAcid aminoAcid2 = contact.getRight();
return SetOperations.unorderedPairsOf(nodes).map(pair -> shortestPaths.get(pair.getLeft()).getPath(pair.getRight())).filter(graphPath -> {
int index1 = graphPath.getVertexList().indexOf(aminoAcid1);
int index2 = graphPath.getVertexList().indexOf(aminoAcid2);
return index1 != -1 && index2 != -1 && Math.abs(index1 - index2) == 1;
}).collect(Collectors.toList());
}
Aggregations