-
Notifications
You must be signed in to change notification settings - Fork 59
Examples
Bruno Silva edited this page Jun 9, 2025
·
3 revisions
The JavaFXSmartGraph repository includes a demonstration module that showcases various features of the library.
-
Location:
com.brunomnsilva.smartgraph.examples
.-
cities.Main
- Representation of city populations and distances; -
digraph.Main
- The main example illustrated in README (a digraph with directed edges); -
dynamic.Main
- Real-time visualization of model updates; -
flowers.Main
- Another example on a simple graph.
-
-
Running the Examples:
- Clone the repository:
git clone https://github.com/brunomnsilva/JavaFXSmartGraph.git
- Navigate to the project directory:
cd JavaFXSmartGraph
- Build the project (including the demo):
mvn clean install
- Try to run one of the above classes. Must be executed as a standard JavaFX application.
- Clone the repository:
The demo applications typically illustrates:
- Creation of graphs and digraphs.
- Different vertex placement strategies (e.g., circular, random).
- Automatic graph layout.
- Interaction with vertices (dragging, selection).
- Display of labels on vertices and edges.
- Arrows for directed edges.
- Self-loops and multiple edges.
- Determining vertex shape and size, based on the underlying model.
- Dynamic updates to the graph.
- Basic styling.
The source code of the demo application (SmartGraphDemo.java
or similar found in smartgraph-demo/src/main/java/...
) is an excellent resource for learning how to use the library's features. It provides practical examples of:
- Initializing
SmartGraphPanel
. - Using
SmartGraphProperties
. - Adding and removing graph elements dynamically.
- Setting up event handlers (e.g., for double clicks).
By running the demo and examining its code, you can gain a deeper understanding of how to integrate JavaFXSmartGraph into your own applications.