Permalink
Browse files

renamed AllShortestPaths to AllPairsShortestPaths as this is the corr…

…ect name for the problem
  • Loading branch information...
1 parent 14d1c60 commit ccbbe480e2e4b4f0ed143ddce3f8a9b0993e32cf @johnmay committed Jan 9, 2013
@@ -27,8 +27,7 @@
import java.util.*;
import org.openscience.cdk.CDKConstants;
-import org.openscience.cdk.exception.CDKException;
-import org.openscience.cdk.graph.AllShortestPaths;
+import org.openscience.cdk.graph.AllPairsShortestPaths;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
@@ -92,7 +91,7 @@ public int getPathCount() {
Set<String> paths = new TreeSet<String>();
// All-Pairs Shortest-Paths (APSP)
- AllShortestPaths apsp = new AllShortestPaths(container);
+ AllPairsShortestPaths apsp = new AllPairsShortestPaths(container);
for (int i = 0, n = container.getAtomCount(); i < n; i++) {
@@ -44,8 +44,8 @@
* molecule.
*
* <blockquote><pre>
- * IAtomContainer benzene = MoleculeFactory.makeBenzene();
- * AllShortestPaths shortestPaths = new AllShortestPaths(benzene);
+ * IAtomContainer benzene = MoleculeFactory.makeBenzene();
+ * AllPairsShortestPaths apsp = new AllPairsShortestPaths(benzene);
*
* for (int i = 0; i &lt; benzene.getAtomCount(); i++) {
*
@@ -54,19 +54,19 @@
* for (int j = i + 1; j &lt; benzene.getAtomCount(); j++) {
*
* // reconstruct shortest path from i to j
- * int[] path = shortestPaths.from(i).pathTo(j);
+ * int[] path = apsp.from(i).pathTo(j);
*
* // reconstruct all shortest paths from i to j
- * int[][] paths = shortestPaths.from(i).pathsTo(j);
+ * int[][] paths = apsp.from(i).pathsTo(j);
*
* // reconstruct the atoms in the path from i to j
- * IAtom[] atoms = shortestPaths.from(i).atomsTo(j);
+ * IAtom[] atoms = apsp.from(i).atomsTo(j);
*
* // access the number of paths from i to j
- * int nPaths = shortestPaths.from(i).nPathsTo(j);
+ * int nPaths = apsp.from(i).nPathsTo(j);
*
* // access the distance from i to j
- * int distance = shortestPaths.from(i).nPathsTo(j);
+ * int distance = apsp.from(i).nPathsTo(j);
*
* }
* }
@@ -77,8 +77,8 @@
* @cdk.githash
* @see ShortestPaths
*/
-@TestClass("org.openscience.cdk.graph.AllShortestPathsTest")
-public final class AllShortestPaths {
+@TestClass("org.openscience.cdk.graph.AllPairsShortestPathsTest")
+public final class AllPairsShortestPaths {
private final IAtomContainer container;
private final ShortestPaths[] shortestPaths;
@@ -89,7 +89,7 @@
* @param container the molecule of which to find the shortest paths
*/
@TestMethod("testConstruction_Null,testConstruction_Empty")
- public AllShortestPaths(IAtomContainer container) {
+ public AllPairsShortestPaths(IAtomContainer container) {
// toAdjList performs null check
int[][] adjacent = ShortestPaths.toAdjList(container);
@@ -110,7 +110,7 @@ public AllShortestPaths(IAtomContainer container) {
* Access the shortest paths object for provided start vertex.
*
* <blockquote><pre>
- * AllShortestPaths asp = ...;
+ * AllPairsShortestPaths apsp = ...;
*
* // access explicitly
* ShortestPaths sp = asp.from(0);
@@ -134,7 +134,7 @@ public ShortestPaths from(int start) {
* Access the shortest paths object for provided start atom.
*
* <blockquote><pre>
- * AllShortestPaths asp = ...;
+ * AllPairsShortestPaths apsp = ...;
* IAtom start, end = ...;
*
* // access explicitly
@@ -452,7 +452,7 @@ public static int getVertexCountAtDistance(IAtomContainer atomContainer, int dis
* <code>end</code> inclusive
* @see ShortestPaths
* @see ShortestPaths#atomsTo(IAtom)
- * @see AllShortestPaths
+ * @see AllPairsShortestPaths
* @deprecated This implementation recalculates all shortest paths from the start atom
* for each method call and does not indicate if there are equally short paths
* from the start to the end. Replaced by {@link ShortestPaths#atomsTo(IAtom)}
@@ -65,14 +65,14 @@
* </pre></blockquote>
*
* <p/> If shortest paths from multiple start atoms are required {@link
- * AllShortestPaths} will have a small performance advantage. Please use {@link
+ * AllPairsShortestPaths} will have a small performance advantage. Please use {@link
* org.openscience.cdk.graph.matrix.TopologicalMatrix} if only the shortest
* distances between atoms is required.
*
* @author John May
* @cdk.module core
* @cdk.githash
- * @see AllShortestPaths
+ * @see AllPairsShortestPaths
* @see org.openscience.cdk.graph.matrix.TopologicalMatrix
*/
@TestClass("org.openscience.cdk.graph.ShortestPathsTest")
@@ -99,13 +99,13 @@
/**
* Create a new shortest paths tool for a single start atom. If shortest
- * paths from multiple start atoms are required {@link AllShortestPaths}
+ * paths from multiple start atoms are required {@link AllPairsShortestPaths}
* will have a small performance advantage.
*
* @param container an atom container to find the paths of
* @param start the start atom to which all shortest paths will be
* computed
- * @see AllShortestPaths
+ * @see AllPairsShortestPaths
*/
@TestMethod("testConstructor_Container_Empty,testConstructor_Container_Null,testConstructor_Container_MissingAtom")
public ShortestPaths(IAtomContainer container, IAtom start) {
@@ -114,7 +114,7 @@ public ShortestPaths(IAtomContainer container, IAtom start) {
/**
- * Internal constructor for use by {@link AllShortestPaths}. This
+ * Internal constructor for use by {@link AllPairsShortestPaths}. This
* constructor allows the passing of adjacency list directly so the
* representation does not need to be rebuilt for a different start atom.
*
@@ -38,17 +38,17 @@
* @author John May
* @cdk.module test-core
*/
-public class AllShortestPathsTest {
+public class AllPairsShortestPathsTest {
@Test(expected = IllegalArgumentException.class)
public void testConstruction_Null() {
- new AllShortestPaths(null);
+ new AllPairsShortestPaths(null);
}
@Test
public void testConstruction_Empty() {
- AllShortestPaths asp = new AllShortestPaths(new AtomContainer());
+ AllPairsShortestPaths asp = new AllPairsShortestPaths(new AtomContainer());
// all vs all fro -10 -> 10
for (int i = -10; i < 10; i++) {
@@ -72,7 +72,7 @@ public void testConstruction_Empty() {
public void testFrom_Atom_Benzene() throws Exception {
IAtomContainer benzene = MoleculeFactory.makeBenzene();
- AllShortestPaths asp = new AllShortestPaths(benzene);
+ AllPairsShortestPaths asp = new AllPairsShortestPaths(benzene);
IAtom c1 = benzene.getAtom(0);
IAtom c2 = benzene.getAtom(1);
@@ -125,7 +125,7 @@ public void testFrom_Atom_Benzene() throws Exception {
public void testFrom_Int_Benzene() throws Exception {
IAtomContainer benzene = MoleculeFactory.makeBenzene();
- AllShortestPaths asp = new AllShortestPaths(benzene);
+ AllPairsShortestPaths asp = new AllPairsShortestPaths(benzene);
// 1 - 2
// / \
@@ -45,7 +45,7 @@
import org.openscience.cdk.exception.CDKExceptionTest;
import org.openscience.cdk.exception.NoSuchAtomExceptionTest;
import org.openscience.cdk.exception.NoSuchAtomTypeExceptionTest;
-import org.openscience.cdk.graph.AllShortestPathsTest;
+import org.openscience.cdk.graph.AllPairsShortestPathsTest;
import org.openscience.cdk.graph.PathToolsTest;
import org.openscience.cdk.graph.ShortestPathsTest;
import org.openscience.cdk.graph.SpanningTreeTest;
@@ -112,7 +112,7 @@
TetrahedralChiralityTest.class,
DoubleBondStereochemistryTest.class,
SpanningTreeTest.class,
- AllShortestPathsTest.class,
+ AllPairsShortestPathsTest.class,
ShortestPathsTest.class,
DynamicFactoryTest.class
})

0 comments on commit ccbbe48

Please sign in to comment.