Index: applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java
===================================================================
--- applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java	(revision 14756)
+++ applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java	(revision 14760)
@@ -97,4 +97,5 @@
 //	private WeightedMultigraph<Node, OsmEdge> graph;
 	private Graph<Node, OsmEdge> graph;
+	private RoutingGraphDelegator rgDelegator=null;
 
 	/**
@@ -126,5 +127,6 @@
 		logger.debug("Creating Graph...");
 		graph = new DirectedWeightedMultigraph<Node, OsmEdge>(OsmEdge.class);
-
+		rgDelegator=new RoutingGraphDelegator(graph);
+		rgDelegator.setRouteType(this.routeType);
 		// iterate all ways and segments for all nodes:
 		for (Way way : data.ways) {
@@ -159,9 +161,11 @@
 	private void addEdge(Way way,Node from, Node to) {
 		double length = from.coor.greatCircleDistance(to.coor);
-		// edge = new OsmEdge(way, length);
+		
 		OsmEdge edge = new OsmEdge(way, from, to);
+		edge.setSpeed(12.1);
 		graph.addEdge(from, to, edge);
 		// weight = getWeight(way);
 		double weight = getWeight(way, length);
+		getWeight(edge, length);
 		logger.debug("edge for way " + way.id
 				     + "(from node " + from.id + " to node "
@@ -180,4 +184,21 @@
 	 * @return
 	 */
+	private void getWeight(OsmEdge osmedge, double length) {
+		
+		osmedge.setLength(length);
+		if (this.waySpeeds.containsKey(osmedge.getWay().get("highway")))
+			osmedge.setSpeed(this.waySpeeds.get(osmedge.getWay().get("highway")));
+					
+	}
+
+	/**
+	 * Returns the weight for the given segment depending on the highway type
+	 * and the length of the segment. The higher the value, the less it is used
+	 * in routing.
+	 *
+	 * @param way
+	 *            the way.
+	 * @return
+	 */
 	private double getWeight(Way way, double length) {
 		// Default speed if no setting is found
@@ -202,5 +223,5 @@
 		return length / speed;
 	}
-
+	
 	/**
 	 * Check is One Way.
@@ -268,5 +289,5 @@
 		else
 			g = new AsUndirectedGraph<Node, OsmEdge>((DirectedWeightedMultigraph<Node,OsmEdge>)graph);
-
+		//TODO: Problemas no tiene encuenta el tema de oneway.
 		switch (algorithm) {
 		case ROUTING_ALG_DIJKSTRA:
@@ -274,5 +295,5 @@
 			DijkstraShortestPath<Node, OsmEdge> routingk = null;
 			for (int index = 1; index < nodes.size(); ++index) {
-				routingk = new DijkstraShortestPath<Node, OsmEdge>(g, nodes
+				routingk = new DijkstraShortestPath<Node, OsmEdge>(rgDelegator, nodes
 						.get(index - 1), nodes.get(index));
 				if (routingk.getPathEdgeList() == null) {
@@ -287,5 +308,5 @@
 			logger.debug("Using Bellman Ford algorithm");
 			for (int index = 1; index < nodes.size(); ++index) {
-				path = BellmanFordShortestPath.findPathBetween(g, nodes
+				path = BellmanFordShortestPath.findPathBetween(rgDelegator, nodes
 						.get(index - 1), nodes.get(index));
 				if (path == null) {
@@ -330,4 +351,5 @@
 	public void setTypeRoute(RouteType routetype) {
 		this.routeType = routetype;
+		this.rgDelegator.setRouteType(routetype);
 	}
 
Index: applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java
===================================================================
--- applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java	(revision 14756)
+++ applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java	(revision 14760)
@@ -7,4 +7,9 @@
 import org.jgrapht.Graph;
 import org.jgrapht.graph.GraphDelegator;
+import org.openstreetmap.josm.data.osm.Node;
+
+import com.innovant.josm.jrt.core.RoutingGraphDelegator;
+import com.innovant.josm.jrt.core.RoutingGraph.RouteType;
+import com.innovant.josm.jrt.osm.OsmEdge;
 
 /**
@@ -12,5 +17,5 @@
  *
  */
-public class RoutingGraphDelegator<V, E> extends GraphDelegator<V, E> {
+public class RoutingGraphDelegator extends GraphDelegator<Node, OsmEdge> {
 
 	/**
@@ -19,7 +24,22 @@
 	static Logger logger = Logger.getLogger(RoutingGraphDelegator.class);
 	
-	public String name;
+	/**
+	 *
+	 */
+	private RouteType routeType;
 	
+	public RoutingGraphDelegator(Graph<Node, OsmEdge> arg0) {
+		super(arg0);
+	}
 	
+
+	public RouteType getRouteType() {
+		return routeType;
+	}
+
+	public void setRouteType(RouteType routeType) {
+		this.routeType = routeType;
+	}
+
 
 	/**
@@ -28,13 +48,13 @@
 	private static final long serialVersionUID = 1L;
 
-	public RoutingGraphDelegator(Graph<V, E> arg0) {
-		super(arg0);
-		// TODO Auto-generated constructor stub
+	@Override
+	public double getEdgeWeight(OsmEdge edge) {
+		double weight=Double.MAX_VALUE;
+		
+		if (routeType==RouteType.SHORTEST) weight=edge.getLength();
+		if (routeType==RouteType.FASTEST) weight=edge.getLength() / edge.getSpeed();
+		// Return the time spent to traverse the way
+		return weight;
 	}
-	
-	@Override
-	public double getEdgeWeight(E arg0) {
-		logger.debug("call getEdgeWeight");
-		return super.getEdgeWeight(arg0);
-	}
+
 }
Index: applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java
===================================================================
--- applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java	(revision 14756)
+++ applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java	(revision 14760)
@@ -32,4 +32,8 @@
 import org.openstreetmap.josm.data.osm.Way;
 
+/**
+ * Class that represents an edge of the graph.
+ * @author jose
+ */
 public class OsmEdge extends DefaultWeightedEdge {
  /**
@@ -37,9 +41,23 @@
   */
   private static final long serialVersionUID = 1L;
+  /**
+   * Way associated
+   */
   private Way way;
+  /**
+   * Nodes in the edge
+   */
   private Node from, to;
+  /**
+   * Length edge
+   */
   private double length;
+  /**
+   * Speed edge.
+   */
+  private double speed;
 
-  /**
+
+/**
    * Constructor
    * @param way
@@ -76,4 +94,15 @@
   	return length;
   }
+  
+  public void setLength(double length) {
+	this.length = length;
+}
 
+public double getSpeed() {
+		return speed;
+  }
+
+  public void setSpeed(double speed) {
+		this.speed = speed;
+  }
 }
Index: applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java
===================================================================
--- applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java	(revision 14756)
+++ applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java	(revision 14760)
@@ -99,6 +99,6 @@
 						routingModel.routingGraph.setTypeRoute(RouteType.FASTEST);
 					}
-					routingModel.routingGraph.resetGraph();
-					routingModel.routingGraph.createGraph();
+				//	routingModel.routingGraph.resetGraph();
+				//	routingModel.routingGraph.createGraph();
 					//TODO: Change this way
 					//FIXME: do not change node but recalculate routing.
@@ -111,5 +111,4 @@
 
 		JRadioButtonMenuItem rfaster = new JRadioButtonMenuItem(tr("Fastest"));
-
 		group.add(rshorter);
 		group.add(rfaster);
