Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
trh010
cs311_final_project
Commits
09039f55
Commit
09039f55
authored
Apr 21, 2014
by
trh010
Browse files
progress
parent
d7a68ee3
Changes
7
Hide whitespace changes
Inline
Side-by-side
CS311_final_project/.classpath
View file @
09039f55
...
...
@@ -2,5 +2,8 @@
<classpath>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"
/>
<classpathentry
kind=
"var"
path=
"JUNIT_HOME/junit.jar"
/>
<classpathentry
kind=
"var"
path=
"AGITAR_MOCK_OBJECTS"
/>
<classpathentry
kind=
"var"
path=
"AGITAR_TEST_LIB"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
CS311_final_project/src/
test/
5lw-m.dat
→
CS311_final_project/src/5lw-m.dat
View file @
09039f55
File moved
CS311_final_project/src/
test/
5lw-s.dat
→
CS311_final_project/src/5lw-s.dat
View file @
09039f55
File moved
CS311_final_project/src/
test/
5lw.dat
→
CS311_final_project/src/5lw.dat
View file @
09039f55
File moved
CS311_final_project/src/main/AdjacencyList.java
View file @
09039f55
...
...
@@ -101,7 +101,7 @@ public class AdjacencyList {
}
private
void
buildDijkstraGraph
(
int
startingVertex
){
Vertex
start
=
getVertexFromHandle
(
startingVertex
);
Vertex
start
=
adjList
.
get
(
startingVertex
);
//Initialize graph
Vertex
temp
;
for
(
int
i
=
0
;
i
<
adjList
.
size
();
i
++){
...
...
@@ -138,7 +138,7 @@ public class AdjacencyList {
}
private
ArrayList
<
Integer
>
findPathRev
(
Vertex
start
,
Vertex
end
,
ArrayList
<
Integer
>
path
){
if
(
end
.
getPred
()
==
-
1
)
if
(
end
.
equals
(
start
)
)
return
path
;
Vertex
next
=
adjList
.
get
(
end
.
getPred
());
path
.
add
(
next
.
getAdjListIndex
());
...
...
@@ -146,23 +146,29 @@ public class AdjacencyList {
return
findPathRev
(
start
,
next
,
path
);
}
p
ublic
String
p
rintPath
(
ArrayList
<
Integer
>
reversedPath
){
p
rivate
String
p
athToString
(
ArrayList
<
Integer
>
reversedPath
){
StringBuffer
out
=
new
StringBuffer
();
for
(
int
i
=
reversedPath
.
size
()
-
1
;
i
>=
0
;
i
--){
out
.
append
(
" "
+
adjList
.
get
(
reversedPath
.
get
(
i
)));
if
((
reversedPath
.
size
()
-
i
)
%
10
==
0
)
out
.
append
(
"\n"
);
}
return
out
.
toString
();
}
public
ArrayList
<
Integer
>
findMinimumPath
(
String
s1
,
String
s2
){
int
s1Handle
=
findStringHandle
(
s1
);
int
s2Handle
=
findStringHandle
(
s2
);
public
String
outputToString
(
int
s1
,
int
s2
){
ArrayList
<
Integer
>
revPath
=
findMinimumPath
(
s1
,
s2
);
return
pathToString
(
revPath
);
}
public
ArrayList
<
Integer
>
findMinimumPath
(
int
s1
,
int
s2
){
System
.
out
.
println
(
s1
);
buildDijkstraGraph
(
s1
Handle
);
buildDijkstraGraph
(
s1
);
return
findPathRev
(
adjList
.
get
(
s1
Handle
),
adjList
.
get
(
s2
Handle
),
new
ArrayList
<
Integer
>());
return
findPathRev
(
adjList
.
get
(
s1
),
adjList
.
get
(
s2
),
new
ArrayList
<
Integer
>());
}
public
int
getDistance
(
String
end
){
...
...
CS311_final_project/src/main/Main.java
View file @
09039f55
...
...
@@ -105,7 +105,8 @@ public class Main {
continue
;
}
//output findings
System
.
out
.
println
(
adjList
.
toString
());
System
.
out
.
println
(
adjList
.
outputToString
(
s1Handle
,
s2Handle
));
boolean
validResponse
=
false
;
while
(!
validResponse
)
{
...
...
@@ -141,7 +142,8 @@ public class Main {
//main.queryUserPart1();
main
.
queryUserPart2
();
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Error! - "
+
e
.
toString
());
System
.
err
.
println
(
"Error! - "
);
e
.
printStackTrace
();
}
}
}
CS311_final_project/src/test/Test.java
deleted
100644 → 0
View file @
d7a68ee3
package
test
;
public
class
Test
{
public
static
void
main
(
String
[]
args
){
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment