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
ccead898
Commit
ccead898
authored
Apr 21, 2014
by
trh010
Browse files
progress made
parent
0ed24ba7
Changes
2
Hide whitespace changes
Inline
Side-by-side
CS311_final_project/src/main/AdjacencyList.java
View file @
ccead898
...
...
@@ -97,4 +97,31 @@ public class AdjacencyList {
}
return
out
.
toString
();
}
private
void
buildDijkstraGraph
(
int
startingVertex
){
//Initialize graph
Vertex
temp
;
for
(
int
i
=
0
;
i
<
adjList
.
size
();
i
++){
temp
=
adjList
.
get
(
i
);
temp
.
setDist
(-
1
);
temp
.
setPred
(-
1
);
}
getVertexFromHandle
(
startingVertex
).
setDist
(
0
);
}
private
ArrayList
<
Integer
>
findPath
(
int
start
,
int
end
,
ArrayList
<
Integer
>
path
){
return
path
;
}
public
ArrayList
<
Integer
>
findMinimumPath
(
String
s1
,
String
s2
){
int
s1Handle
=
findStringHandle
(
s1
);
int
s2Handle
=
findStringHandle
(
s2
);
buildDijkstraGraph
(
s1Handle
);
return
findPath
(
s1Handle
,
s2Handle
,
new
ArrayList
<
Integer
>());
}
}
CS311_final_project/src/main/Vertex.java
View file @
ccead898
...
...
@@ -7,14 +7,34 @@ public class Vertex {
private
String
key
;
private
int
handle
;
private
ArrayList
<
Edge
>
edges
;
private
int
pred
;
private
int
dist
;
public
Vertex
(
String
word
,
int
handle
,
ArrayList
<
Edge
>
neighbors
)
{
this
.
key
=
word
;
this
.
handle
=
handle
;
this
.
edges
=
neighbors
;
pred
=
-
1
;
dist
=
-
1
;
}
public
int
getHandle
()
{
public
int
getPred
()
{
return
pred
;
}
public
void
setPred
(
int
pred
)
{
this
.
pred
=
pred
;
}
public
int
getDist
()
{
return
dist
;
}
public
void
setDist
(
int
dist
)
{
this
.
dist
=
dist
;
}
public
int
getHandle
()
{
return
handle
;
}
...
...
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