ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
AllPairsShortestPaths.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------- File AllPairsShortestPaths.h ----------------------*/
3/*--------------------------------------------------------------------------*/
50/*--------------------------------------------------------------------------*/
51/*----------------------------- DEFINITIONS --------------------------------*/
52/*--------------------------------------------------------------------------*/
53
54#ifndef __ADS_AllPairsShortestPaths
55 #define __ADS_AllPairsShortestPaths
56/* self-identification: #endif constant */
57
58/*--------------------------------------------------------------------------*/
59/*------------------------------ INCLUDES ----------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62#include "ADS/Contract.h"
63#include "ADS/graph/Graph.h"
65
66#include <vector>
67
68/*--------------------------------------------------------------------------*/
69/*--------------------------- NAMESPACE ------------------------------------*/
70/*--------------------------------------------------------------------------*/
71
72namespace ADS
73{
74
76template< class D >
78{
79 std::vector< std::vector< D > > d;
80 std::vector< std::vector< int > > p;
81 bool negativeCycle = false;
82 };
83
108template< Graph G >
110
135template< class D >
136void addEdge( AllPairs< D > & R , int a , int b , const D & w );
137
138/*--------------------------------------------------------------------------*/
139
140} // end( namespace ADS )
141
142/*--------------------------------------------------------------------------*/
143/*-------------------------- IMPLEMENTATION --------------------------------*/
144/*--------------------------------------------------------------------------*/
145
146#include "ADS/graph/impl/AllPairsShortestPaths.tpp"
147
148/*--------------------------------------------------------------------------*/
149
150#endif /* AllPairsShortestPaths.h included */
151
152/*--------------------------------------------------------------------------*/
153/*-------------------- End File AllPairsShortestPaths.h --------------------*/
154/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The shortest paths of chapter 11 from a node of an oriented GRAPH whose edges have a cost [see Grap...
The GRAPH of chapter 9 and its realizations.
void addEdge(AllPairs< D > &R, int a, int b, const D &w)
the insertion of the edge of cost ,
AllPairs< typename G::Weight > floydWarshall(const G &g)
the shortest paths between all the pairs of nodes
Definition ADT.h:96
the distances, the predecessors and whether there is a negative cycle
Definition AllPairsShortestPaths.h:78
bool negativeCycle
whether a negative cycle exists
Definition AllPairsShortestPaths.h:81
std::vector< std::vector< D > > d
the distance of each pair
Definition AllPairsShortestPaths.h:79
std::vector< std::vector< int > > p
the predecessor of each pair
Definition AllPairsShortestPaths.h:80