I’m working on a basic image manipulation program, and currently have 3 classes: Vertex, Graph, and Manipulations.

public class Vertex{ //Vertex functions, including tracking neighbours } public class Graph{ Vertex[][] aVertices; public Graph(Color[][] image){ int xTop = 0; for (int i = 0; i < image.length; i++){ if (i > xTop){ xTop = i; } } int yTop = image.length; Vertex[][] aVertices = new Vertex[xTop][yTop]; for(int i = 0; i < xTop; i++){ for(int j = 0; j < yTop; j++){ Vertex newVertex = new Vertex(i, j, image[i][j]); aVertices[i][j] = newVertex; } } for(int i = 0; i < xTop; i++){ for(int j = 0; j < yTop; j++){ if(aVertices[i][j] == aVertices[i-1][j]){ aVertices[i][j].neighbourize(aVertices[i-1][j]); } if(aVertices[i][j] == aVertices[i+1][j]){ aVertices[i][j].neighbourize(aVertices[i+1][j]); } if(aVertices[i][j] == aVertices[i][j-1]){ aVertices[i][j].neighbourize(aVertices[i][j-1]); } if(aVertices[i][j] == aVertices[i][j+1]){ aVertices[i][j].neighbourize(aVertices[i][j+1]); } } } } } public class Manipulations{ //Image manipulations that access aVertices }

As you can see, upon creation of the graph, a 2D array is created that holds vertex objects, which are then assigned appropriate neighbour statuses with shared colours. I now want to take this entire aVertices and work on it inside of Manipulations, but am not really sure how to move it within the appropriate scope. Would anyone be able to point me in the right direction?

I think you are lack of the knowledge of Object Oriented Programming.

For your question, you can define such method in Graph.

public Vertex[][] getVertices() { return this.aVertices; }

In Manipulations, you can get aVertices with

Graph g = new Graph(image); Vertex[][] vertices = g.getVertices();