Index: applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/EdgeSelectionAction.java
===================================================================
--- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/EdgeSelectionAction.java	(revision 33389)
+++ applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/EdgeSelectionAction.java	(revision 33390)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -44,18 +45,20 @@
 
     /*
-     * given a way, it looks at both directions until it finds a
-     * crossway (parents.size > 2) or until the end of the
-     * edge (parens.size = 1)
+     * given a way, it looks at both directions for good candidates to be added
+     * to the edge
      */
-    private List<Way> getEdgeFromWay(Way initial)
+    private List<Way> getEdgeFromWay(Way initial, String modeOfTravel)
     {
     	List<Way> edge = new ArrayList<>();
+    	if(!isWaySuitableForMode(initial, modeOfTravel))
+    		return edge;
 
     	Way curr = initial;
     	while(true) {
-    		List<Way> parents = curr.firstNode(true).getParentWays();
-    		if(parents.size() != 2)
+    		List<Way> options = curr.firstNode(true).getParentWays();
+    		options.remove(curr);
+    		curr = chooseBestWay(options, modeOfTravel);
+    		if(curr == null || edge.contains(curr))
     			break;
-    		curr = parents.get(0) == curr ? parents.get(1) : parents.get(0);
     		edge.add(curr);
     	}
@@ -63,8 +66,9 @@
     	curr = initial;
     	while(true) {
-    		List<Way> parents = curr.lastNode(true).getParentWays();
-    		if(parents.size() != 2)
+    		List<Way> options = curr.lastNode(true).getParentWays();
+    		options.remove(curr);
+    		curr = chooseBestWay(options, modeOfTravel);
+    		if(curr == null || edge.contains(curr))
     			break;
-    		curr = parents.get(0) == curr ? parents.get(1) : parents.get(0);
     		edge.add(curr);
     	}
@@ -74,11 +78,51 @@
     }
 
-    @Override
+    private Boolean isWaySuitableForMode(Way toCheck, String modeOfTravel)
+    {
+    	if("bus".equals(modeOfTravel))
+    		return RouteUtils.isWaySuitableForBuses(toCheck);
+
+    	return RouteUtils.isWaySuitableForPublicTransport(toCheck);
+    }
+
+    /*
+     *
+     */
+    private Way chooseBestWay(List<Way> ways, String modeOfTravel)
+    {
+    	ways.removeIf(w -> !isWaySuitableForMode(w, modeOfTravel));
+    	if(ways.isEmpty())
+    		return null;
+    	if(ways.size() == 1)
+    		return ways.get(0);
+
+    	Way theChoosenOne = null;
+
+    	if("bus".equals(modeOfTravel))
+    	{
+
+    	}
+    	if("tram".equals(modeOfTravel))
+    	{
+
+    	}
+
+    	return theChoosenOne;
+    }
+
+    private String getModeOfTravel() {
+    	//find a way to get the currently opened relation editor and get the
+    	//from there the current type of route
+		return "bus";
+	}
+
+	@Override
     public void mouseClicked(MouseEvent e) {
 
 		DataSet ds = Main.getLayerManager().getEditLayer().data;
     	Way initial = Main.map.mapView.getNearestWay(e.getPoint(), OsmPrimitive::isUsable);
-    	if(initial != null)
-    		ds.setSelected(getEdgeFromWay(initial));
+    	if(initial != null){
+    		ds.setSelected(getEdgeFromWay(initial, getModeOfTravel()));
+    	}
     	else
     		ds.clearSelection();
@@ -99,5 +143,5 @@
     	else {
     		Main.map.mapView.setCursor(waySelectCursor);
-    		highlighted.addAll(getEdgeFromWay(initial));
+    		highlighted.addAll(getEdgeFromWay(initial, getModeOfTravel()));
     	}
 
