|
2 | 2 |
|
3 | 3 | ## Project Overview |
4 | 4 |
|
5 | | -GraphVisual is a Java Swing desktop application for visualizing community evolution in student/social networks using the [JUNG](http://jung.sourceforge.net/) (Java Universal Network/Graph Framework) library. |
| 5 | +GraphVisual is a Java graph visualization and analysis platform built with [JUNG](http://jung.sourceforge.net/) (Java Universal Network/Graph Framework). It includes a Swing desktop GUI, 100+ graph algorithm implementations, and a docs site with interactive HTML dashboards. |
6 | 6 |
|
7 | 7 | ## Architecture |
8 | 8 |
|
9 | | -### Source Layout |
10 | | -- `Gvisual/src/gvisual/` — GUI & visualization layer |
11 | | - - `Main.java` — Main application class (~1600 lines). Contains the Swing GUI, JUNG graph rendering, timeline controls, category panel, and notes pane. |
12 | | - - `edge.java` — Edge data model for graph connections. |
13 | | -- `Gvisual/src/app/` — Data processing & network analysis layer |
14 | | - - `Network.java` — Core network/graph construction logic. Builds graphs from data, computes community structures. |
15 | | - - `Util.java` — Utility methods for data parsing, file I/O, and helper functions. |
16 | | - - `addLocation.java` — Location-based data enrichment. |
17 | | - - `findMeetings.java` — Meeting/interaction detection between users. |
18 | | - - `matchImei.java` — IMEI-based device matching. |
19 | | -- `Gvisual/test/` — JUnit tests |
20 | | - - `app/UtilMethodsTest.java` — Tests for utility methods. |
21 | | - - `gvisual/EdgeTest.java` — Tests for edge model. |
22 | | -- `Gvisual/lib/` — Third-party JARs (JUNG 2.0.1, PostgreSQL JDBC, commons-io, etc.) |
23 | | -- `Gvisual/images/` — UI icons and button images. |
| 9 | +### Source Layout (272 Java files) |
| 10 | +- `Gvisual/src/gvisual/` — GUI, visualization, and algorithm layer (~260 classes) |
| 11 | + - `Main.java` — Swing GUI entry point with JUNG graph rendering, timeline controls, category panel |
| 12 | + - `edge.java` — Edge data model |
| 13 | + - Algorithm analyzers: `ArticulationPointAnalyzer`, `BipartiteAnalyzer`, `CliqueAnalyzer`, `CommunityDetector`, `LouvainCommunityDetector`, `PageRankAnalyzer`, `ShortestPathFinder`, `SpectralAnalyzer`, `NetworkFlowAnalyzer`, etc. |
| 14 | + - Layout engines: `CircularLayout`, `ForceDirectedLayout`, `HierarchicalLayout` |
| 15 | + - Exporters: `DotExporter`, `GexfExporter`, `GraphMLExporter`, `JsonGraphExporter`, `SvgExporter`, `InteractiveHtmlExporter`, `CsvReportExporter` |
| 16 | + - Utilities: `GraphUtils`, `GraphStats`, `GraphGenerator`, `FamousGraphLibrary`, `GraphQueryEngine` |
| 17 | +- `Gvisual/src/app/` — Data processing & network construction |
| 18 | + - `Network.java` — Graph construction from data |
| 19 | + - `Util.java` — Parsing, file I/O, helpers |
| 20 | + - `ThresholdConfig.java` — Configurable thresholds |
| 21 | + - `LocationResolver.java`, `addLocation.java`, `findMeetings.java`, `matchImei.java` |
| 22 | +- `Gvisual/test/` — 105 JUnit test files |
| 23 | +- `Gvisual/lib/` — Third-party JARs (legacy; Maven preferred) |
| 24 | +- `docs/` — GitHub Pages site with interactive graph algorithm dashboards |
24 | 25 |
|
25 | 26 | ### Build System |
26 | 27 | - **Maven** (primary): `pom.xml` at project root |
27 | | -- Build: `mvn compile` |
28 | | -- Test: `mvn test` |
29 | | -- Package: `mvn package` (produces JAR in `target/`) |
30 | | -- Legacy **Ant** (NetBeans-generated): `Gvisual/build.xml` — still present but Maven is preferred |
| 28 | + - `mvn compile` — Build |
| 29 | + - `mvn test` — Run 105 JUnit test suites |
| 30 | + - `mvn package` — Produce JAR in `target/` |
| 31 | +- **Java 11** (compiler source/target in pom.xml) |
| 32 | +- Legacy **Ant** (`Gvisual/build.xml`) — still present but Maven is preferred |
31 | 33 |
|
32 | | -### Key Dependencies |
| 34 | +### Key Dependencies (from pom.xml) |
33 | 35 | - **JUNG 2.0.1** — Graph algorithms, layout, visualization |
34 | 36 | - **Java Swing** — GUI framework |
35 | 37 | - **PostgreSQL JDBC** — Database connectivity |
36 | | -- **commons-io 1.4** — File utilities |
37 | | -- **Java3D / vecmath** — 3D visualization support |
| 38 | +- **JUnit 4** — Testing framework |
| 39 | +- **commons-io** — File utilities |
| 40 | +- **vecmath** — 3D vector math support |
38 | 41 |
|
39 | 42 | ## Conventions |
40 | 43 |
|
41 | | -- Package names are lowercase (`gvisual`, `app`) |
42 | | -- Class names follow Java conventions (PascalCase) except for `edge.java` which is lowercase |
43 | | -- The project was originally built with NetBeans IDE |
44 | | -- Java 8+ compatible (uses generics, collections framework) |
45 | | -- No Maven/Gradle — dependencies are committed as JARs in `lib/` |
| 44 | +- Package names: lowercase (`gvisual`, `app`) |
| 45 | +- Class names: PascalCase (exception: legacy `edge.java`) |
| 46 | +- Algorithm classes follow the pattern: `XxxAnalyzer` with `analyze()` method returning results |
| 47 | +- Exporter classes follow: `XxxExporter` with `export()` method |
| 48 | +- Test classes: `XxxTest.java` mirroring source structure |
46 | 49 |
|
47 | 50 | ## How to Test |
48 | 51 |
|
49 | | -1. Run `mvn test` for JUnit tests (preferred) |
50 | | -2. Legacy: `cd Gvisual && ant test` |
51 | | -3. Tests are in `Gvisual/test/` mirroring the source package structure |
52 | | -4. When adding new tests, place them in the corresponding test package |
| 52 | +```bash |
| 53 | +mvn test # Run all 105 test suites |
| 54 | +mvn test -Dtest=ShortestPathFinderTest # Run a specific test |
| 55 | +mvn test -pl . -Dtest="gvisual.*" # Run all gvisual package tests |
| 56 | +``` |
| 57 | + |
| 58 | +When adding new tests, place them in `Gvisual/test/` matching the source package. |
53 | 59 |
|
54 | 60 | ## Common Patterns |
55 | 61 |
|
56 | | -- Graph construction uses JUNG's `UndirectedSparseGraph<String, edge>` |
57 | | -- Visualization uses JUNG's `VisualizationViewer` with custom renderers |
58 | | -- Layout algorithms: `StaticLayout`, `FRLayout`, `KKLayout` from JUNG |
59 | | -- Event handling follows standard Swing `ActionListener` pattern |
| 62 | +- Graph construction: `UndirectedSparseGraph<String, edge>` (JUNG) |
| 63 | +- Visualization: JUNG's `VisualizationViewer` with custom renderers |
| 64 | +- Layout algorithms: `StaticLayout`, `FRLayout`, `KKLayout` from JUNG, plus custom `CircularLayout`, `ForceDirectedLayout`, `HierarchicalLayout` |
| 65 | +- Event handling: standard Swing `ActionListener` pattern |
| 66 | +- Algorithm results: typically returned as `Map<String, Object>` or dedicated result classes |
60 | 67 |
|
61 | 68 | ## Notes for AI Agents |
62 | 69 |
|
63 | | -- The `Main.java` file is very large (~1600 lines). Consider refactoring into separate classes for GUI components, graph operations, and data management. |
64 | | -- The `edge` class should be renamed to `Edge` to follow Java naming conventions. |
65 | | -- Database connection details may be hardcoded — check `Network.java` for configuration. |
66 | | -- The project bundles all dependencies as JARs — no dependency manager is used. |
| 70 | +- `Main.java` is large (~1600 lines) — when modifying, focus on the specific section needed |
| 71 | +- Many algorithm analyzers are self-contained: one class, one test file, no dependencies beyond JUNG and `GraphUtils` |
| 72 | +- The `docs/` directory is a separate GitHub Pages site — changes there don't affect the Java build |
| 73 | +- Database configuration may be in `Network.java` — check before modifying DB-related code |
| 74 | +- Use `mvn compile -q` to verify compilation after changes |
0 commit comments