Skip to content

Running JGraphT demos

John Sichi edited this page Nov 27, 2018 · 7 revisions

JGraphT has a demo package org.jgrapht.demo which includes small demo applications. These classes provide a good starting point to learn how to work with JGraphT. Moreover, all classes come with corresponding test classes. These test classes provide a valuable source of usage examples (see the source code of your desired JGraphT release).

To run the graph visualization demo from the downloaded release, try executing this command in the lib directory:

java -jar jgrapht-demo-x.y.z.jar

To run a different demo class, use:

java -cp jgrapht-demo-x.y.z.jar org.jgrapht.demo.<DemoName>
For instance:
java -cp jgrapht-demo-1.1.0.jar org.jgrapht.demo.CompleteGraphDemo

If you want more control over the demos, e.g. you want to play around and make modifications, it is recommended that you first download the source code of your desired version, or, alternatively, download the master branch. Next, follow the instructions for your specific IDE (skip the instructions pertaining the Java formatting rules and imports styles):

For the full list of demos available, see the demo package.

You can’t perform that action at this time.