/* =============================================================== */ #include "meta.h" int node_distance () { /* node_distance starts with the page array and page_link matrix, assuming that for all nodes the dist_to_base field is currently marked as either UNREACHED or 0. It then fills in the dist_to_base fields of as yet UNREACHED nodes with their distance from any reached node. It normally returns the maximal distance + 1 found for any connected node. If a node is initially neither UNREACHED nor 0, it returns -2. If no node is 0 (no base), it returns -1. */ extern int num_pages; extern struct page_rec page[]; extern char page_link[]; int next_level, page_ix, from_dex, to_dex, empty, pageloc[MAX_PAGE]; int dtb, fromloc,toloc; next_level = -1; /* set up list for *bidirectional* breadth-first search; this list contains, first, reached nodes, then an empty slot, then unreached nodes */ from_dex = 0; to_dex = num_pages; for (page_ix=0 ; page_ix