From 9c71a9046f0ec13040593d915ca9eea88edf0f38 Mon Sep 17 00:00:00 2001 From: Dennis Albrecht <5196458+d-albrecht@users.noreply.github.com> Date: Thu, 8 Mar 2018 14:27:00 +0000 Subject: [PATCH] Strip unset elements from paths Paths like shortest paths may be padded with "0" entries in the front if the path's length doesn't match the length of the internal array. Trimming the list before retrieving the internal array eliminates those additional entries. This should have better performance than letting the end-user distinguish padding-entries from intended entries referring to node "0". --- src/grph/path/SearchResultWrappedPath.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/grph/path/SearchResultWrappedPath.java b/src/grph/path/SearchResultWrappedPath.java index 271f9be..5aa4705 100755 --- a/src/grph/path/SearchResultWrappedPath.java +++ b/src/grph/path/SearchResultWrappedPath.java @@ -108,6 +108,7 @@ public int[] toVertexArray() } s.add(source); + s.trim(); this.vertexArray = s.elements(); Arrays.reverse(this.vertexArray); }