connected matrix allocation