1 | initial version |
Figured it out myself.
My iteration starts with a graph of just one edge, then adds different types of edges to it. Initially, I had
G=Graph({0:[1],1:[]})
I checked in detail through the Sage manual pages on graphs, and found that there are options multiedges
and loops
that can be set for a given graph. So now I have
G=Graph(multiedges=True,loops=True)
G.add_edge(0,1)
This gives me exactly what I want. Now G.add_edge(0,0)
adds a loop to the graph, and G.add_edge(0,1)
makes it have a pair of multiple edges.
My problem was that Sage assumes False
values by default for these options, meaning that a graph by default is simple.