I know that add_vertex! is not part of the AbstractGraph interface, but the documentation seems to use an implicit assumption that when you add a vertex to a graph, it is denoted by the integer |V| + 1, where |V| is the number of vertices in the graph before the new vertex is added. Is this behavior assumed to apply to any AbstractGraph? Of course, the examples in the documentation use SimpleGraphs, so it's not clear if this assumption applies to any AbstractGraph or only to any AbstractSimpleGraph.
For example, if this behavior is not guaranteed for an AbstractGraph, then the value of added in the code below is undefined:
struct SomeGraph <: AbstractGraph
# etc
end
g = SomeGraph(2)
add_edge!(g, 1, 2)
add_vertex!(g)
added = add_edge!(g, 1, 2)
In other words, without the guarantee above, it's possible that when add_vertex! is called above the new vertex is given label 1 and the old vertex labels are incremented by 1, e.g. 1 -> 2 and 2 -> 3. If that were the case, then the second add_edge! would be successful and we would have added == true, and the list of edges would now be [Edge(1, 2), Edge(2, 3)]. However, if the new vertex index is 3, then the second add_edge! would be unsuccessful and we would have added == false, and the list of edges would be [Edge(1, 2)].
More generally speaking, it's rather difficult to keep track of vertices if we don't know what happens to vertex labels/indices when we add a new vertex.