-
Notifications
You must be signed in to change notification settings - Fork 107
Bug in implementation of weight #141
Copy link
Copy link
Open
Description
The weight function is supposed to dispatch to the weight* protocol. The weight* protocol has implementors implement an arity for discovering the weight of an edge: (weight* g e). However, the weight function completely ignores this aspect of the protocol and never calls it for edges. The existing implementation of weight calls weight* instead on the src and dest nodes, which poses a problem for graphs where the edge is not uniquely determined by src and dest.
The correct implementation of weight which respects the full weight* protocol is:
(defn weight
"Returns the weight of edge e or edge [n1 n2]"
([g] (partial weight g))
([g e] (weight* g e))
([g n1 n2] (weight* g n1 n2)))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels