A graph theoretic characterization for the rank of the transfer matrix of a structured system