I want to form a connectivity matrix from a vector file:
an N x N symmetric matrix called C with non-zero entries
in C(i,j) when the area labeled with category i shares a border
with the area labeled with category j (assuming all areas
have unique labels). "Connected" means they share a line, not
just a node.
Looking over the structs for topology files, I don't believe that
this information is explicitly stored (correct me if I'm wrong).
Before I get too carried away, has anyone ever done this?
Seems simple: for (i=0;i<Plus_head.n_areas;++i)
for (j=0;j<P_area.n_lines;++j) {
/* must cross line j, returns adjacent category */
k=find_area_which_shares_line(i,j);
c[cat_of_area(i)][cat_of_area(k)]++;
}
If anyone knows a easy way to do this or can suggest
the best src program and/or library functions to use
as a starting point, I would be grateful for a short
reply in private email.
Thanks,
--Darrell