We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
(require '[loom.graph :as g] '[loom.attr :as ga]) (-> (g/digraph {:a [:b]}) (ga/add-attr [:a :b] :foo :bar) (g/remove-nodes :a) (ga/attrs [:a :b])) => {:foo :bar}
Is this intentional, or an oversight? I can believe either, though I'd prefer the latter to be the case.
The text was updated successfully, but these errors were encountered:
A quickie implementation of attribute pruning, if anyone needs it:
(defn- prune-attrs "Prunes the attributes of a graph to refer only to nodes in the [keep] set. e.g. (update (g/subgraph g reachable) :attrs (partial prune-attrs reachable))" [keep attrs] (reduce (fn [attrs [n nattrs]] (if-not (keep n) (dissoc attrs n) (let [edge-attrs (::ga/edge-attrs nattrs) edge-attrs' (reduce #(if (keep %2) % (dissoc % %2)) edge-attrs (keys edge-attrs))] (cond (identical? edge-attrs edge-attrs') attrs (empty? edge-attrs') (update attrs n dissoc ::ga/edge-attrs) :default (assoc-in attrs [n ::ga/edge-attrs] edge-attrs'))))) attrs attrs))
Perhaps there's a fancier-faster way, but this is a workaround for me for now.
Sorry, something went wrong.
No branches or pull requests
Is this intentional, or an oversight? I can believe either, though I'd prefer the latter to be the case.
The text was updated successfully, but these errors were encountered: