fork(1) download
  1. #include <string>
  2. #include <vector>
  3.  
  4. class Graph {
  5. public:
  6. Graph( const std::string & );
  7. ~Graph();
  8.  
  9. void print();
  10.  
  11. private:
  12.  
  13. struct GEdge;
  14.  
  15. struct GNode
  16. {
  17. std::string currency_type;
  18. std::vector<GEdge> edges; // line 19
  19.  
  20. GNode( std::string name ) : currency_type( name ) {}
  21. };
  22.  
  23. struct GEdge
  24. {
  25. int weight;
  26. GNode * node; // node that the edge is pointed towards
  27.  
  28. GEdge( int weight, GNode* node )
  29. : weight( weight ), node( node ) {}
  30. };
  31.  
  32. GNode *source;
  33. std::vector<GNode> nodes;
  34.  
  35. void add_node( const std::string & currency );
  36. void add_edge( const GNode *& source, const GNode *& destination, int weight );
  37. std::string bellman_ford( const GNode *&source );
  38. };
  39.  
  40. int main()
  41. {
  42.  
  43. }
  44.  
Success #stdin #stdout 0s 2892KB
stdin
Standard input is empty
stdout
Standard output is empty