public void testDijkstra() { SharedGraph g = g1(); DijkstraInfo a = Dijkstra.FindShortestPath(g, 5, 4); Assert.AreEqual(13, a.cost); List <int> sa = new List <int>() { 5, 1, 8, 3, 7, 4 }; Assert.AreEqual(sa, a.shortestPath); DijkstraInfo b = Dijkstra.FindShortestPath(g, 4, 8); Assert.AreEqual(6, b.cost); List <int> sb = new List <int>() { 4, 7, 3, 8 }; Assert.AreEqual(sb, b.shortestPath); DijkstraInfo c = Dijkstra.FindShortestPath(g, 5, 8); Assert.AreEqual(7, c.cost); List <int> sc = new List <int>() { 5, 1, 8 }; Assert.AreEqual(sc, c.shortestPath); }
private void Awake() { _cubicGrid = new SharedGraph(); _cubicGrid.Initialize(Graph.Factory.CreateCubicGrid(CountX, CountY, CountZ)); _cubicGrid.TensegrityObjects.AddRange(CreatTensegrityObjects()); transform.position = new Vector3(-CountX * 0.5f, -CountY * 0.5f, -CountZ * 0.5f); }
// Use this for initialization void Start() { CubicGrid = transform.GetComponent <ShiftedGraphManager>().CubicGrid(); _graph = CubicGrid.Graph; Depth = new int[_graph.VertexCount]; TenVertex = CubicGrid.TensegrityObjects; _queue = new Queue <int>(); }