int main(int argc, char const *argv[])
{
    int N, M, S, D;
    scanf("%d %d %d %d", &N, &M, &S, &D);
    Vertex *AdjacencyList = (Vertex*)malloc(N * sizeof(Vertex));
    int *WeightsOfDistance = (int*)malloc(N * sizeof(int));
    int *WeightsOfPrice = (int*)malloc(N * sizeof(int));
    ReadEdge2Graph(AdjacencyList, N, M);
    ResetWeights(WeightsOfDistance, N);
    ResetWeights(WeightsOfPrice, N);
    WeightsOfDistance[S] = WeightsOfPrice[S] = 0;
    BFS(AdjacencyList[S], AdjacencyList, WeightsOfDistance, WeightsOfPrice);
    printf("%d %d\n", WeightsOfDistance[D], WeightsOfPrice[D]);
    return 0;
}
Example #2
0
File: VQModel.cpp Project: nykm/sop
void VQModel::Train(const std::vector< DynamicVector<Real> >& samples, unsigned int iterations)
{
    LBG lbg(GetOrder());

    mClusterWeights.resize(GetOrder());
    
    ResetWeights();

    std::vector<unsigned int> indices;

    lbg.Cluster(samples, indices, mClusterCentroids, mClusterSizes);
}