Question

I'm building a graph editor with Piccolo2D and want to implement Loom's Graph protocol. However I run into problem

Unable to resolve symbol: out-edges in this context

What really confusing is that I can use successors in has-edge.

(extend-type PCanvas
  Graph
  (nodes [g]
    (->children (->node-layer g)))

  (edges [g]
    (->children (->edge-layer g)))

  (has-node? [g node]
    (some #{node} (nodes g)))

  (has-edge? [g n1 n2]
    (some #{n2} (successors g n1)))

  (successors
    ([g] (partial successors g))
    ([g node]
       (remove (partial = node)
               (distinct (flatten (apply concat 
                                         (map ->nodes (out-edges g node))))))))

  (out-degree [g node]
    (count (out-edges g node)))

  (out-edges [g node]
    (->edges node)))

So in what condition protocol methods can call others?

Edit: Full error message: http://pastebin.com/NDWEZZ7y

Was it helpful?

Solution 2

There is no such method in the current release, 0.4.2, which is 4 months old, see https://github.com/aysylu/loom/blob/0.4.2/src/loom/graph.clj#L13. You are probably looking at the master branch in GitHub, changes made 23 days ago, not yet in a release.

OTHER TIPS

I released Loom version 0.5.0 which includes the multigraph support.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top