コード例 #1
0
    bool hasPosibility()
    {
        int vertex = getActualVertex();

        for (int i = 0; i < 26; i++)
        {
            int weight = BoardGraph.getWeight(vertex, i);
            if (weight != -1 && !isVisited(i))
            {
                return(true);
            }
        }
        return(false);
    }
コード例 #2
0
    public List <string> find(int value)
    {
        int           vertex = getActualVertex();
        List <string> path   = new List <string>();

        for (int i = 0; i < 26; i++)
        {
            int weight = BoardGraph.getWeight(vertex, i);
            if (weight != -1 && weight == value && !isVisited(i))
            {
                path.Add(i.ToString());
            }
        }
        return(path);
    }
コード例 #3
0
 void dijkstra(int startNode)
 {
     distance[startNode] = 0;
     for (int i = 0; i < 26; i++)
     {
         int lower = getLowerNotVisited();
         visited[lower] = true;
         for (int j = 0; j < 26; j++)
         {
             int weight = BoardGraph.getWeight(lower, j);
             if (weight == -1)
             {
                 continue;
             }
             int newDistance = distance[lower] + weight;
             if (newDistance < distance[j])
             {
                 distance[j] = newDistance;
             }
         }
     }
 }