public void DFSUtil(int v, bool[] visited, int x, int y, Grid grid, GridRepo gridRepo, Graph graph) { visited[v] = true; Grid aux = gridRepo.gridRepo.ElementAt(v); Tuple tup; if (graph.isLeaf(v)) { tup = aux.gridSize(); if (x * y > tup.getX() * tup.getY()) { this.grid.setGrid(aux.grid); setMinX(tup.getX()); setMinY(tup.getY()); } } IEnumerator <int> i = graph.adj.ElementAt(v).GetEnumerator(); bool hasNext = i.MoveNext(); while (hasNext) { int n = i.Current; hasNext = i.MoveNext(); if (!visited[n]) { DFSUtil(n, visited, this.getMinX(), this.getMinY(), this.grid, gridRepo, graph); } } }
public void GBFSUtil(int parent, bool[] visited, int x, int y, Grid grid, GridRepo gridRepo, Graph graph) { visited[parent] = true; Grid aux = gridRepo.gridRepo.ElementAt(parent); Tuple tup; if (graph.isLeaf(parent)) { tup = aux.gridSize(); if (x * y > tup.getX() * tup.getY()) { this.getT().setGrid(aux.getGrid()); setMinX(tup.getX()); setMinY(tup.getY()); } } else { int kid = graph.findMin(gridRepo, parent); GBFSUtil(kid, visited, this.getMinX(), this.getMinY(), this.getT(), gridRepo, graph); } }