Macaulay2 / Workshop-2020-Warwick

6 stars 9 forks source link

newDigraph not explicitly defined #48

Closed olgakuznetsova closed 4 years ago

olgakuznetsova commented 4 years ago

https://github.com/Macaulay2/Workshop-2020-Warwick/blob/053dd559060d5bf5bd709c0f1e0c8e525375f89c/AlgebraicStatistics/MLE/StatGraphs.m2#L80

It only appears once in the above mentioned line and is among the exported symbols (see https://github.com/Macaulay2/Workshop-2020-Warwick/blob/053dd559060d5bf5bd709c0f1e0c8e525375f89c/AlgebraicStatistics/MLE/StatGraphs.m2#L32)

If you remove it from exports, the package doesn't install

stdio:18:1:(3): error: mutable unexported unset symbol(s) in package StatGraphs: 'newDigraph'
StatGraphs.m2:79:13-79:23: here is the first use of 'newDigraph'
harshitmotwani2015 commented 4 years ago

@olgakuznetsova I was trying to resolve this issue, but couldn't. I think the problem is that we are exporting a hashtable and its related to the export of keys of any hashtable in M2.

I have found a temporary solution to this.

I have just declared newDigraph in the method before its use. See code below. Now with this temporary fix, you can remove "newDigraph" from the export list.

topSort = method() topSort Digraph := SortedDigraph => D -> ( L := topologicalSort D; g := graph D; newDigraph := {}; new SortedDigraph from { digraph => D, newDigraph => digraph hashTable apply(#L, i -> i + 1 => apply(toList g#(L_i), j -> position(L, k -> k == j) + 1)), map => hashTable apply(#L, i -> L_i => i + 1) } )

olgakuznetsova commented 4 years ago

turns out this doesn't work, unfortunately. If you do not export newDigraph, then GraphicalModels doesn't load

i3 : loadPackage "GraphicalModels" stdio:3:1:(3): error: mutable unexported unset symbol(s) in package GraphicalModels: 'newDigraph' GraphicalModels.m2:1059:19-1059:29: here is the first use of 'newDigraph'. I guess it's not too important, so l just brought everything back to the original state and we'll need to document newDigraph for now. If we have time in the end, we can ask tips for how to handle this on the M2 Google Group

olgakuznetsova commented 4 years ago

Commented out newDigraph in GraphicalModels. Seems to work without problems, will leave this way for now.