My guesses are (from the way I have been using graphs):
a) Create two kind of functions: one destructive and the other one
non-destructive. For example (assuming g is a "graph_thing")
g2 : add_edge(g,[1,2]);
g2 : add_edgeD(g,[1,2]);
The first one could create a new graph and preserve g (and all the
information) while the second one could create g2 destroying g (making it
garbage).
b) Create functions which tell the program whether to keep the info into
the graph or not:
M : adjacency_matrix(g);
M : adjacency_matrixK(g);
The first could simply return the adj. matrix, while the second could
store it in your "graph" structure or in a hash table, or any way you
want.
Merry Christmas to everybody,
Pedro.
Pedro Fortuny Ayuso -------------> http://pfortuny.sdf-eu.org
School of Mathematical Sciences. Queen Mary College, Univ. London
Mile End Road, London E1 4NS, UK ------> www.qmul.ac.uk
pfortuny@sdf-eu.org Tfn. Nr. 44 20 7882 5493