Template PowerGraph
Fonction de PowerGraph.
template PowerGraph(Fun...)
;
Contained Functions
Contained Functions
Name | Description |
---|
PowerGraph | Cette fonction doit être executé par tout le monde
|
Contained Classes
Contained Classes
Name | Description |
---|
LV | Classe utilisé pour savoir si le sommet est tjrs actif à l'étape X.
|
Contained Aliases
Contained Aliases
Parameters
Name | Description |
Fun | [une fonction de map, une fonction de réduction, une fonction de jointure, une fonction d'arret] |
Example
// DistGraph!(DstVertex, EdgeD) grp = ...;
// DstVertex contient, la distance en float.
auto pgraph = grp.MapVertices !(
(VertexD v) => v.id == 0 ? new DstVertex (v.data, 0.0, 1.0) :
new DstVertex (v.data, float.infinity, float.infinity)
);
//Calcul des distances de 0 vers tout le monde.
auto sssp = pgraph.PowerGraph ! (
(EdgeTriplet!(DstVertex, EdgeD) e) => iterator (e.dst.id, e.src.dst + 1),
(float a, float b) => min (a, b),
(DstVertex v, float a) => a < v.dst ? new DstVertex (v.data, a, v.dst) :
new DstVertex (v.data, v.dst, a),
(EdgeTriplet!(DstVertex, EdgeD) e) =>
iterator (e.src.id, abs (a.src.dst - a.src.old) > float.epsilon ||
e.src.dst == float.infinity)
) (100); // On execute 100 tour.