Skip to content

Examples

Bruno Silva edited this page Jun 2, 2025 · 3 revisions

The JavaFXSmartGraph repository includes a demonstration module that showcases various features of the library.

Examples

  • Location: com.brunomnsilva.smartgraph.Main and com.brunomnsilva.smartgraph.example.ExampleMain.

  • Running the Examples:

    1. Clone the repository: git clone https://github.com/brunomnsilva/JavaFXSmartGraph.git
    2. Navigate to the project directory: cd JavaFXSmartGraph
    3. Build the project (including the demo): mvn clean install
    4. Try to run one of the above classes. Must be executed as a standard JavaFX application.

Key Features Demonstrated

The demo application 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.

Studying the Demo Code

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.

Clone this wiki locally