I have a PostgreSQL 9.3.7 database scheme representing a directed graph of vertices and edges with some many-to-many relations. I'm only ever interested in getting all vertices that a given vertex points to or getting all vertices that point to a given vertex.
For each many-to-many relationship, I could simply give each of the two tables a bigint[] (array) column to represent what the object points to or is pointed from. When adding an object, I would go through all its bigint[] columns I'm inserting and append itself to the corresponding bigint[] columns (inverse relations) in other tables. Edit: Actually, I have some other many-to-many relations that need to be flexible, so I use separate tables for those. But I am guarenteed that for the ones in question, I only need the queries described above.
This seems more efficient than the conventional approach of making a separate table for the relationship, plus it's less complicated. But I've never heard of anyone doing this, so I'm worried. Would such an approach have any flaws that I'm not considering?