Skip to content
This repository was archived by the owner on Oct 21, 2021. It is now read-only.
This repository was archived by the owner on Oct 21, 2021. It is now read-only.

Discussion: why should we allow edges / vertices to be anything other than Ints? #143

@sbromberger

Description

@sbromberger

At least for now.

It seems to me we'd have a much simpler task if we created a basic G={V,E} design with V and E as integers (perhaps Int128 for REALLY large graphs) and pairs, respectively. Any additional metadata / attributes (weights, names, etc) could be derived by lookup and, with proper indexing, could maintain O(1) time. Mapping could also be used to generate deterministic attributes.

This would simplify a whole slew of issues relating to type conversion, return values, etc, (#140) and would allow us (me, primarily, since I'm less steady than others) to focus on adding functionality to a known type of graph as opposed to worrying about how method X performs with graphs that don't support O(1) indexing, or don't have attribute Y, etc. It also makes consistency of return values straightforward (see, e.g., #142).

We're practically doing this already for all functions that return an array of vertex indices anyway, and with functions (I'm looking at you, dijkstra_shortest_paths()) that require a separate vector of data (edge_dists, or VectorEdgePropertyInspector(edge_dists)) in order to work in some respect.

(Yes, I know I was campaigning for something other than simple_graph earlier; I'm throwing this out for discussion now that I'm grokking the code a bit more.)

It also allows us to separate functions that act ON a graph from functions that act on ATTRIBUTES of a graph's components, and would likely simplify persistent storage of graph data.

Anyway - adoption of this proposal would break things, perhaps horrifically. Are there other arguments against?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions