~ubuntu-branches/ubuntu/saucy/gfan/saucy-proposed

« back to all changes in this revision

Viewing changes to graph.h

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2013-07-09 10:44:01 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130709104401-5q66ozz5j5af0dak
Tags: 0.5+dfsg-3
* Upload to unstable.
* modify remove_failing_tests_on_32bits.patch to replace command of
  0009RenderStairCase test with an empty one instead of deleting it.
* remove lintian override about spelling error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef GRAPH_H_INCLUDED
 
2
#define GRAPH_H_INCLUDED
 
3
 
 
4
#include <set>
 
5
#include <string>
 
6
 
 
7
using namespace std;
 
8
 
 
9
class Graph{
 
10
  int n;
 
11
  bool isDirected;
 
12
  class Edge{
 
13
  public:
 
14
    int a,b;
 
15
  Edge(int a_, int b_):
 
16
    a(a_),
 
17
      b(b_)
 
18
      {
 
19
      }
 
20
    bool operator<(const Edge &e)const
 
21
    {
 
22
      return (a<e.a)||((a==e.a)&&(b<e.b));
 
23
    }
 
24
  };
 
25
  set<Edge> edges;
 
26
 public:
 
27
 Graph(int numberOfVertices, bool isDirected_=false):
 
28
  n(numberOfVertices),
 
29
    isDirected(isDirected_)
 
30
  {
 
31
  }
 
32
  void addEdge(int a, int b)
 
33
    {
 
34
      edges.insert(Edge(a,b));
 
35
    }
 
36
  int diameter(int *timesAttained=0)const;
 
37
  string toString()const;
 
38
};
 
39
#endif