- (graph-copy (G <graph>))method
Creates a shallow copy of (multi)(di)graph G, depending on the type of G. Deep copies are not provided, but they are typically unnecessary unless you are writing directly to a slot value or using set! haphazardly in your code. Using the methods provided by the graphs egg for primitive operations such as adding or removing vertices and edges should nullify this issue.
This may not seem like a terribly useful method to have; however, using this in conjunction with destructive operations can help hide side effects on graphs. Because non-destructive operations have to construct a copy of the graph for small changes, they can have larger performance implications down the line (adding 1 vertex to a graph with 100000 vertices means you have to first copy the original graph and then add 1 vertex to that copy destructively). If anybody has any ideas for constructing an efficient functional hash-table or graph type, please let me know, as currently this implementation utilizes srfi-69, which provides traditional (and very imperative) hash-tables.