public boolean isConnected(Node from, Node to) {
		Position p1 = from.getPosition();
		Position p2 = to.getPosition();
		
		double d = p1.squareDistanceTo(p2); 
		if(d <= r_min_squared) {
			return true; // the two nodes are always connected
		}
		if(d > r_max_squared) {
			return false; // the two nodes are never connected
		}
		// the distance between the two nodes is between r_min and r_max. Now, we randomly 
		// determine whether the edge exists or not. 

		if(probabilityType == 1) { // linear probability
			probability = Math.sqrt(d) * m + q;
		} else if(probabilityType == 2) { // quadratic probability
			// ... not yet implemented
		}
		if(rand.nextDouble() <= probability) {
			return true;
		} else {
			return false;
		}
	}