<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,10 +1,12 @@
 #include &quot;graf.h&quot;
 
+using namespace std;
+
 /**
  * Graph Destructor. Cleans the Vertex objects.
  *
  */
-Graph::~Graph() {
+ Graph::~Graph() {
 	for(vertex_map::iterator i = vmap.begin(); i != vmap.end(); ++i)
 		delete (*i).second;
 }
@@ -17,7 +19,7 @@ Graph::~Graph() {
  * @param int
  *
  */
-void Graph::addVertex(unsigned int k, double x, double y) {
+Vertex* Graph::addVertex(unsigned int k, double x, double y) {
 	vertex_map::iterator i = vmap.find(k);
 
 	if (i == vmap.end() ) {
@@ -41,7 +43,7 @@ Vertex* Graph::getVertex(int v) {
 	vertex_map::iterator i = vmap.find(v);
 
 	if (i == vmap.end() ) {
-		Vertex *new_vert = new Vertex(v);
+		Vertex *new_vert = new Vertex(0.0, 0.0);
 		vmap[ v ] = new_vert;
 		return new_vert;
 	}
@@ -78,7 +80,7 @@ void Graph::clearAlg() {
  */
 void Graph::printPath(const Vertex&amp; to) const {
 	if (to.prev != NULL) {
-		printPath(*from.prev); 
+		printPath(*to.prev); 
 		cout &lt;&lt; &quot; to&quot;;
 	}
 	cout &lt;&lt; &quot;(&quot; &lt;&lt; to.x &lt;&lt; &quot;,&quot; &lt;&lt; to.y &lt;&lt; &quot;)&quot;;
@@ -90,16 +92,16 @@ void Graph::printPath(const Vertex&amp; to) const {
 void Graph::printPath(int to) const {
 	vertex_map::const_iterator i = vmap.find(to);
 	if (i == vmap.end() )
-		throw GraphException( &quot;Destination vertex not found in the graph&quot; );
+		return; //throw GraphException( &quot;Destination vertex not found in the graph&quot; );
 
 	const Vertex&amp; w = *(*i).second;
-	if (w.dist == INFINITY )
-		cout &lt;&lt; to;
+	if (w.dist == numeric_limits&lt;double&gt;::infinity() )
+		std::cout &lt;&lt; to;
 	else {
-		cout &lt;&lt; w.dist &lt;&lt; &quot; &quot;;
+		std::cout &lt;&lt; w.dist &lt;&lt; &quot; &quot;;
 		printPath(w);
 	}
-	cout &lt;&lt; endl;
+	std::cout &lt;&lt; endl;
 }
 
 /**
@@ -109,8 +111,8 @@ void Graph::printPath(int to) const {
  */
 void Graph::unweighted(int from) {
 	vertex_map::iterator i = vmap.find(from);
-	if (i == vmap.end() ) 
-		throw GraphException(from + &quot; isn't vertex in this Graph&quot;);
+	if (i == vmap.end() ) return; 
+		//throw GraphException(from + &quot; isn't vertex in this Graph&quot;);
 
 	clearAlg();
 	Vertex *first = (*i).second;
@@ -125,7 +127,7 @@ void Graph::unweighted(int from) {
 		for (int i = 0; i &lt; vadjs; ++i) {
 			Edge e = v-&gt;adj[ i ];
 			Vertex *w = e.to;
-			if (w-&gt;dist == INFINITY) {
+			if (w-&gt;dist == numeric_limits&lt;double&gt;::infinity()) {
 				w-&gt;dist = v-&gt;dist + 1;
 				w-&gt;prev = v;
 				q.push_back(w);
@@ -144,33 +146,33 @@ void Graph::weighted(int from) {
 	priority_queue&lt;Path, vector&lt;Path&gt;, greater&lt;Path&gt; &gt; pq;
 	Path vrec;
 
-	vector_map::iterator i = vmap.find(from);
+	vertex_map::iterator i = vmap.find(from);
 	if (i == vmap.end() )
-		throw GraphException(from + &quot; isn't a vertex in this graph&quot;);
+		return; //throw GraphException(from + &quot; isn't a vertex in this graph&quot;);
 
 	clearAlg();
 	Vertex *first = (*i).second;
 	pq.push(Path(first, 0) ); 
-	start-&gt;dist = 0;
+	first-&gt;dist = 0;
 
 	int totalVs = vmap.size();
-	for (int visitedVs = 0; visitedVs &lt; totalVs; ++vistedVs) {
+	for (int visitedVs = 0; visitedVs &lt; totalVs; ++visitedVs) {
 		do {
 			if (pq.empty() ) return;
 			vrec = pq.top();
 			pq.pop();
-		} while (vrec.to-&gt;scraatch != 0);
+		} while (vrec.to-&gt;scratch != 0);
 
-		Vertex *v vrec.dest;
+		Vertex *v = vrec.to;
 		v-&gt;scratch = 1;
 
 		int vadjs = v-&gt;adj.size();
 		for(int i = 0; i &lt; vadjs; ++i) {
 			Edge e = v-&gt;adj[ i ];
-			Vertex *w = e.dest;
+			Vertex *w = e.to;
 			double costvw = e.cost;
 			if (costvw &lt; 0) 
-				throw GraphException(&quot;Edges can't have negative cost&quot;);
+				//throw GraphException(&quot;Edges can't have negative cost&quot;);
 
 			if (w-&gt;dist &gt; v-&gt;dist+costvw) {
 				w-&gt;dist = v-&gt;dist + costvw;</diff>
      <filename>graf.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
-#include &lt;limits.h&gt;
+#include &lt;math.h&gt;
+#include &lt;limits&gt;
 #include &lt;fstream&gt;
 #include &lt;sstream&gt;
+#include &lt;iostream&gt;
 #include &lt;map&gt;
 #include &lt;vector&gt;
 #include &lt;string&gt;
@@ -8,10 +10,13 @@
 #include &lt;functional&gt;
 #include &lt;list&gt;
 
+using namespace std;
+
 /**
  *	A Class representing a vertex of a graph
  *
  */
+class Edge;
 
 class Vertex 
 {
@@ -33,17 +38,17 @@ public:
 	Vertex ( double xco, double yco ) : x(xco), y(yco) {
 		reset();
 	}
-private:
+
 	/**
 	 *	Method to reset fields for the algorithm
 	 *
 	 */
 	void reset() {
-		dist = INFINITY;
+		dist = numeric_limits&lt;double&gt;::infinity();
 		prev = NULL;
 		scratch = 0;
 	}
-}
+};
 
 /**
  *	Class representing an edge in graph
@@ -65,7 +70,7 @@ public:
 	 */
 	Edge( Vertex *d = 0, double c = 0.0 ) : to(d), cost(c) { }
 
-}
+};
 
 /**
  *	class for a priority queue for searching weighted shortest-path algorithm
@@ -86,7 +91,7 @@ public:
 	bool operator&lt;(const Path&amp; other) const {
 		return cost &lt; other.cost;
 	}
-}
+};
 
 /**
  * Graph class
@@ -104,7 +109,7 @@ public:
 	Graph() {}
 	~Graph();
 
-	void addVertex (int key, double x, double y);
+	Vertex* addVertex (unsigned int key, double x, double y);
 	void addEdge (int from, int to, double cost);
 	void printPath (int to) const;
 	void unweighted (int from);
@@ -124,5 +129,5 @@ private:
 
 	vertex_map vmap;
 
-}
+};
 </diff>
      <filename>graf.h</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 #include &quot;graf.h&quot;
+using namespace std;
 
 int main(int argc, char* argv[] )
 {
@@ -14,7 +15,7 @@ int main(int argc, char* argv[] )
 	}
 	
 	Graph graph;
-	cout &lt;&lt; &quot;Reading graph from file...&quot; &gt;&gt; endl;
+	cout &lt;&lt; &quot;Reading graph from file...&quot; &lt;&lt; endl;
 	string curr_line;
 
 	//Reead vertices
@@ -26,7 +27,7 @@ int main(int argc, char* argv[] )
 		++lcount;
 	}
 	unsigned int vertidx = 0;
-	while (in_file.gcount &gt; 0) {
+	while (in_file.gcount() &gt; 0) {
 		double vx, vy;
 		istringstream buff(line);
 
@@ -47,7 +48,7 @@ int main(int argc, char* argv[] )
 	if (!getline(in_file, line).eof() ) {
 		++lcount;
 	}
-	while (in_file.gcount &gt; 0) {
+	while (in_file.gcount() &gt; 0) {
 		unsigned int v, w;
 		double cost;
 		istringstream buff(line);
@@ -57,7 +58,7 @@ int main(int argc, char* argv[] )
 		if (buff.fail() )
 			cerr &lt;&lt; &quot;Incorrect line in input file: &quot; &lt;&lt; line &lt;&lt; endl &lt;&lt; &quot;On line :&quot; &lt;&lt; lcount &lt;&lt; endl;
 		else {
-			graph.addEdge(v, y, cost);
+			graph.addEdge(v, w, cost);
 			++vertidx;
 		}
 		if (!getline(in_file, line).eof() ) {
@@ -69,7 +70,7 @@ int main(int argc, char* argv[] )
 	if (!getline(in_file, line).eof() ) {
 		++lcount;
 	}
-	while (in_file.gcount &gt; 0) {
+	while (in_file.gcount() &gt; 0) {
 		unsigned int from, to;
 		istringstream buff(line);
 		buff &gt;&gt; from;
@@ -77,13 +78,13 @@ int main(int argc, char* argv[] )
 		if (buff.fail() )
 			cerr &lt;&lt; &quot;Incorrect line in input file: &quot; &lt;&lt; line &lt;&lt; endl &lt;&lt; &quot;On line :&quot; &lt;&lt; lcount &lt;&lt; endl;
 		else {
-			try {
+			//try {
 				graph.unweighted(from);
 				graph.printPath(to);
-			}
-			catch (const GraphException&amp; e) {
-				cerr &lt;&lt; e.toString( ) &lt;&lt; endl;
-			}
+			//}
+			//catch (const GraphException&amp; e) {
+			//	cerr &lt;&lt; e.toString( ) &lt;&lt; endl;
+			//}
 		}
 		if (!getline(in_file, line).eof() ) {
 			++lcount;</diff>
      <filename>main.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e58b8e9842e5b8f9fb464ff26977b3921cb5ec34</id>
    </parent>
  </parents>
  <author>
    <name>Pawel Ptaszynski</name>
    <email>pptaszynski@gmail.com</email>
  </author>
  <url>http://github.com/pptaszynski/aisdi-graf/commit/786bb80298bb597bc1f3b8520d774cfe8446773e</url>
  <id>786bb80298bb597bc1f3b8520d774cfe8446773e</id>
  <committed-date>2008-06-11T20:01:34-07:00</committed-date>
  <authored-date>2008-06-11T20:01:34-07:00</authored-date>
  <message>Removed errors pointed by compiler. Outcommented exception handling.</message>
  <tree>f3a81ef39f51f5e3d9a7d8eab68285308f91c372</tree>
  <committer>
    <name>Pawel Ptaszynski</name>
    <email>pptaszynski@gmail.com</email>
  </committer>
</commit>
