read file, return connection matrix