-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Is it possible to attach a unique label to a vertex #6
Comments
I can work around this issue by keeping a map of |
Hiya, thanks for your interest & a good question. Custom vertex IDs are supported, but not exactly as what you're after...
(require '[thi.ng.fabric.core :as f])
(defn random-uuid (fn [_] (java.util.UUID/randomUUID)))
(def g (f/compute-graph {::f/id-gen-fn random-uuid})) This however doesn't directly do what you asked for and I guess this is something which could be refactored (but would have to be supplied at construction time and couldn't be changed afterwards).
(def VAT (f/add-vertex! g 1.2 {:cell-id :vat-rate})) Then to obtain that (e.g. inside a collection function, whilst processing the signal map): (->> sig-id (f/vertex-for-id g) f/state :cell-id) Does this help? |
Thanks a lot for your response. In the local context, for example inside a collection function, I think approach 2) would definitely work to get a mapping from In the longer term, I think I think This would also really help the end user in introspecting the values of the vertices in a large enough graph. Thanks again. |
That's a great idea and I will refactor this asap... would also be faster to acess during processing, but would too need to include a check that the user specified ID is unique during construction. cheers! |
Thanks a lot! |
Hi,
Thanks for this library. It looks really interesting and powerful.
I am looking at the
spreadsheet
example and trying to understand the vertex collection functions. By the looks of it,(f/signal-map v)
returns a map of type{<id> value ...}
, where<id>
is the vertex number in the graph.Is it possible to change that
<id>
into something user specified, so that the end user can reason about which value is associated with which node without trying to look it up in the graph.I hope this makes sense.
cheers
The text was updated successfully, but these errors were encountered: