public static void InitializeVariables(MazeGraph <T> G) { unvisited = new List <int>(G.numVert()); g = new MazeGraph <T>(G.numVert(), G.rows, G.cols); for (int i = 0; i < G.numVert(); ++i) { unvisited.Add(i); } }
static public MazeGraph <T> Execute(MazeGraph <T> G) { initializeVariables(G); int current = rand.Next(g.numVert()); visited[current] = true; do { current = Kill(current); if (current == -1) { current = Hunt(); } } while (current != -1); return(g); }
static public void initializeVariables(MazeGraph <T> G) { counter = G.numVert(); g = new MazeGraph <T>(counter, G.rows, G.cols); visited = new bool[counter]; rand = new System.Random(); }
public static MazeGraph <T> Execute(MazeGraph <T> G) { InitializeVariables(G); for (int i = 0; i < g.numVert(); ++i) { List <MazeGraph <T> .VertexCost> neighbors = new List <MazeGraph <T> .VertexCost>(); List <MazeGraph <T> .VertexCost> adj = G[i]; foreach (MazeGraph <T> .VertexCost v in adj) { if (v.vertex > i) { neighbors.Add(v); } } if (neighbors.Count > 0) { int idx = rand.Next(0, neighbors.Count); MazeGraph <T> .VertexCost neighbor = neighbors[idx]; g.addEdge(i, neighbor.vertex, neighbor.cost); g.addEdge(neighbor.vertex, i, neighbor.cost); } } return(g); }
static public void initializeVariables(MazeGraph <T> G) { N = G.numVert(); g = new MazeGraph <T>(N, G.rows, G.cols); added = new bool[N]; added[0] = true; //first node; edge = new Edge <T>(0, 0, default(T)); queue = new PartialOrderedTree <Edge <T> >(N * ((N - 1) / 2) - N + 2); }
static void initializeVariables(MazeGraph <T> G) { n = G.numVert(); g = new MazeGraph <T>(n, G.rows, G.cols); P = new Partition(n); queue = new PartialOrderedTree <Edge <T> >(n * n); for (int i = 0; i < n; ++i) { List <MazeGraph <T> .VertexCost> adj = G.Adjacents(i); for (int j = 0; j < adj.Count; ++j) { queue.insert(new Edge <T>(i, adj[j].vertex, adj[j].cost)); } } }
public static void InitializeVariables(MazeGraph <T> G) { g = new MazeGraph <T>(G.numVert(), G.rows, G.cols); rand = new Random(); }