Open tpetkovich opened 6 years ago
I have managed to trace the problem. It is caused by the Java VM, because it is using my locale settings and the scanner function does not recognize commas as decimal separators. (Instead it would expect periods) It would be nice to add a "scanner.useLocale(Locale.US);" to the java code, so there would be less problems with locale settings.
ah ha! thank you! this probably explains #29 , which I haven't been otherwise able to reproduce. Were you also seeing the error message from MDSJ layout?
Yes, the output looks like this:
> network.layout.animate.MDSJ(network.initialize(5))
[1] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[4] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[7] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[10] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[13] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[16] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[19] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[22] "distance matrix is missing entries?" "distance matrix is missing entries?" "distance matrix is missing entries?"
[25] "distance matrix is missing entries?" "MDSJ starting stress: 0.0" "MDSJ ending stress: 0.0"
[,1] [,2]
[1,] 0.6093728 0.8179096
[2,] 0.5387998 0.1502008
[3,] 0.7931164 0.8762649
[4,] 0.4284446 0.5294074
[5,] 0.7514934 0.8307045
My temporary solution was to trace edit network.layout.animate.MDSJ
45 command = paste("java -cp ", paste(mdsj.path, file.path(mdsj.path,
46 "mdsj.jar"), sep = sep), "MDSJWrapper", n, dim, verbosity,
47 max_iter, filename, coord.file)
to:
45 command = paste("java -Duser.language=en -cp ", paste(mdsj.path, file.path(mdsj.path,
46 "mdsj.jar"), sep = sep), "MDSJWrapper", n, dim, verbosity,
47 max_iter, filename, coord.file)
But in the long term, scanner.useLocale(Locale.US); could be the best option to fix in the MDSJWrapper class.
My another attempt was to set the JAVA_TOOL_OPTIONS global environment variable in Windows to apply "-Duser.language=en" for java runs globally. But it outputs a "Picked up JAVA_TOOL_OPTIONS: -Duser.language=en” line before every java execution, and that was messing up the MDSJWrapper output (even if the coordinates were good, the added line offset the whole output, and the R parser could not handle it). This means, that in situations, when the JAVA_TOOL_OPTIONS or _JAVA_OPTIONS environment variables are set, the R parser will fail to read the output correctly. And there may be plenty of situations, when something sets those environment variables: https://www.google.com/search?q=picked+up+java_tool_options
Greetings,
I do have some problem with the network.layout.animate.MDJS(). Even if the output to the MDSJWrapper.class should be valid with a layout.distance() generated matrix, the MDSJWrapper outputs "distance matrix is missing entries?" for all entries, and the layout output coords will be random.
To reproduce, just use the example in the Statnet tutorial (https://statnet.github.io/Workshops/ndtv_workshop.html#adjusting-spacing-of-isolates-and-components):
It will not result the desired output, instead just a random layout.
Version info: