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
です。しかし、なぜ?個別のマップを使用するようにするにはどうすればよいですか?