I have an issue installing and using the latest version of jgrapht with Python mode. I used to work with an older version tailored for Processing but that port is very limited and is missing most of the functions and classes of the original library.
I have downloaded version 1.5.0, put it in the library folder and renamed it jgrapht.
However:
the library doesn’t show up in the sketch/import a library menu
manual import with add_library('jgrapht') returns an error:
“Maybe there’s an unclosed paren or quote mark somewhere before this line?”
generating an exception makes possible to overcome this error but then no class seems accessible
try:
add_library('jgrapht')
except:
pass
G = SimpleWeightedGraph(DefaultWeightedEdge)
NameError: name 'SimpleWeightedGraph' is not defined
When dropping the jgrapht-core-1.5.0 jar file directly onto the folder and importing manually a class, an UnsupportedClassVersionError is returned
from org.jgrapht.alg.shortestpath import DijkstraShortestPath
java.lang.UnsupportedClassVersionError: org/jgrapht/alg/shortestpath/DijkstraShortestPath has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Does that mean that jgrapht is only compatible with Processing 4 ?
If so, does Python mode work with Processing 4 ?
I just installed Processing 4.0 alpha 2 following the instructions from the official repo but it seems Python mode doesn’t work correctly. Pressing the “play” button doesn’t launch anything: no canvas window, no working console.
Can anyone confirm this ? Just to be sure I’m not the only one getting this issue.
Edit: Following the clarification from @GoToLoop I went on installing JGraphT version 1.3.0 and all seems to work fine now with Processing 3 Python mode. Just be sure to drop the jgrapht-core-1.3.0.jar file (inside the jgrapht/lib folder) on your sketch window and manually import the classes of your choice.
from org.jgrapht.graph import SimpleWeightedGraph, DefaultWeightedEdge
from org.jgrapht.alg.shortestpath import DijkstraShortestPath