Generating a unique file name for each graph
I am writing a function whose input is a graph and some other data. I would like to store the computations that this program does each time it is run in a file with one file for each graph, so that, the next time it is run, it need not recalculate the calculations it has already done. In order to do this, I would like to assign a unique file name to each graph. I was thinking of using the hash function of the combinatorial object constructed from the graph to generate file names: CombinatorialObject(G).__hash__()
I have two questions:
Will this always work (the function taking a graph to this hash is well-defined and injective)?
Is there a better way to do this?
I get the impression that `CombinatorialObject(G)` just captures the vertex set of `G`. Eg sage: CombinatorialObject(graphs.PetersenGraph()).__hash__() 4020364995504644057 sage: CombinatorialObject(graphs.CycleGraph(10)).__hash__() 4020364995504644057 Perhaps using a database would be an alternative for this? You can use the graph6 string of the canonically labelled graph for querys. I've used mongodb with sage and it works pretty well.
@fidelbc Thanks for the comments, and bringing MongoDB to my attention.