Boost :: Graphで私の最初のステップを実行していて、予期しない動作が発生しました。ブーストグラフの外部プロパティが異常に動作していますか?
私が望むのは、一連のedge_weight
プロパティ(実行時にしか数値がわかりません)を持ち、一定の制約を満たすすべての重みの最小値を使用することです。まず、typedef
宣言は次のように
typedef adjacency_list<vecS, vecS, undirectedS, property<vertex_distance_t, int>, property<edge_weight_t, int> > Graph;
typedef graph_traits<Graph>::edge_descriptor Edge;
typedef property_map<Graph, edge_weight_t>::type WeightMap;
typedef property_map<Graph, vertex_distance_t>::type DistanceMap;
私は、グラフを初期化します。
void testcase() {
int t, e, s, a, b;
cin >> t >> e >> s >> a >> b;
Graph g(t);
WeightMap fastestLinkWeight = get(edge_weight, g);
vector<WeightMap> weightMaps(s);
for (int i=0;i<e;i++) {
int u, v;
cin >> u >> v;
Edge edge; bool worked;
tie(edge, worked) = add_edge(u, v, g);
for (int j=0;j<s;j++) {
cin >> weightMaps[j][edge];
}
fastestLinkWeight[edge] = INT_MAX;
cout << weightMaps[0][edge] << "\n";
}
}
をそして、それは何度もINT_MAX
を出力します。 (外部)weightMaps[j]
はすべて同じで、内部プロパティーfastestLinkWeight
と同じです。しかし、なぜ?別のマップを使用するにはどうすればよいですか?