diff options
Diffstat (limited to 'src/com.example.portfolio3/com/example/portfolio3/MatrixGraph.java')
-rw-r--r-- | src/com.example.portfolio3/com/example/portfolio3/MatrixGraph.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/com.example.portfolio3/com/example/portfolio3/MatrixGraph.java b/src/com.example.portfolio3/com/example/portfolio3/MatrixGraph.java index aac4726..985fcbb 100644 --- a/src/com.example.portfolio3/com/example/portfolio3/MatrixGraph.java +++ b/src/com.example.portfolio3/com/example/portfolio3/MatrixGraph.java @@ -25,7 +25,7 @@ public class MatrixGraph extends AbstractGraph { /// foo /// @param numVertex maximum number of vertices allowed - public MatrixGraph(int numVertex){ + public MatrixGraph(final int numVertex){ this.numVertex=numVertex; matrix =new Integer[numVertex][numVertex]; index2vertex=new Vertex[numVertex]; @@ -34,7 +34,7 @@ public class MatrixGraph extends AbstractGraph { /// foo /// @param v vertex /// @return int - private int getIndex(Vertex v){ + private int getIndex(final Vertex v){ if(vertex2index.containsKey(v)) return vertex2index.get(v); int index=vertex2index.size(); if(index>=index2vertex.length)throw new RuntimeException("Too many vertices in graph"); @@ -44,7 +44,7 @@ public class MatrixGraph extends AbstractGraph { } /// foo - public void insertEdge(Vertex v1,Vertex v2,int w){ + public void insertEdge(final Vertex v1, final Vertex v2, final int w){ matrix[getIndex(v1)][getIndex(v2)] = w; } @@ -62,7 +62,7 @@ public class MatrixGraph extends AbstractGraph { } /// foo - public Collection<Edge> outEdge(Vertex v1){ + public Collection<Edge> outEdge(final Vertex v1){ HashSet<Edge> edges=new HashSet<>(); int i=vertex2index.get(v1); for(int j=0;j<numVertex;j++){ @@ -74,7 +74,7 @@ public class MatrixGraph extends AbstractGraph { } /// foo - public Integer getWeight(Vertex v1,Vertex v2){ + public Integer getWeight(final Vertex v1, final Vertex v2){ // constant time operation return matrix[vertex2index.get(v1)][vertex2index.get(v2)];} } |