OldGraphs.jl
OldGraphs.jl copied to clipboard
Move num_vertices and num_edges into required interfaces
Currently, traverse_graph
declares the vertex colormap parameter as defaulting to zeros(Int, num_vertices(graph))
and the edge colormap defaulting to zeros(Int, num_edges(graph))
. There is no easy way to check the requirement that the graph support vertex_list
and edge_list
for default parameters. That said, it is difficult to envision a graph data structure that does not have a handle on the number of edges or vertices. It might make things easier if we moved them from the list interfaces to the required interface.
On the other hand, the requirement that the indices returned by the vertex_map
and edge_map
run from 1 to num_vertices
or num_edges
is what is making deleting edges and vertices difficult. Separating max_vertex_index
from num_vertices
would allow much greater flexibility at relatively low cost. Graphs could range from the current restrictive implementation to one based on open addressed hashtables (somewhat akin to networkx). This would have minimal effect on the current algorithms or interfaces, but would add flexibility to the package.
That said, it is difficult to envision a graph data structure that does not have a handle on the number of edges or vertices.
Might this be a problem on distributed graphs? Not that we support them currently :-)