Skip to content

Allow arbitrary additional keys in a graph? #53

@yuhan0

Description

@yuhan0

An Ubergraph exposes the hash map interface, however the implementation of clojure.core map functions only allows for a closed set of keys and turns everything else into a no-op:

(get [this key default-value]

This seems to go against the Clojure design philosophy of having open data structures – I should be able to assoc extra information to the graph and have it be "ignored" by any function that doesn't request for it.

(-> (uber/digraph)
  (uber/add-edges [1 2])
  (assoc
    :extra/info "foo"
    :date-created "2019-10-02")
  (keys))
;; => (:node-map :allow-parallel? :undirected? :attrs :cached-hash)

What's the rationale for this behavior? Loom graphs for instance allow for it by default since they are plain records.
Is there some other API for adding attributes to the graph as a whole?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions