https://github.com/sauravbhattacharya001/graphvisual
A graph visual application to study community evolution in student communities.
https://github.com/sauravbhattacharya001/graphvisual
bluetooth-proximity community-detection data-visualization desktop-application graph-visualization java jung-framework maven network-analysis postgresql research-tool social-network-analysis
Last synced: 3 days ago
JSON representation
A graph visual application to study community evolution in student communities.
- Host: GitHub
- URL: https://github.com/sauravbhattacharya001/graphvisual
- Owner: sauravbhattacharya001
- License: mit
- Created: 2016-09-19T15:46:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2026-04-03T04:38:26.000Z (10 days ago)
- Last Synced: 2026-04-03T05:36:43.174Z (10 days ago)
- Topics: bluetooth-proximity, community-detection, data-visualization, desktop-application, graph-visualization, java, jung-framework, maven, network-analysis, postgresql, research-tool, social-network-analysis
- Language: Java
- Homepage:
- Size: 7.95 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# π GraphVisual
**Community evolution visualization for student social networks**
Built with Java and [JUNG](http://jung.sourceforge.net/) (Java Universal Network/Graph Framework)
[](https://github.com/sauravbhattacharya001/GraphVisual/actions/workflows/ci.yml)
[](https://github.com/sauravbhattacharya001/GraphVisual/actions/workflows/codeql.yml)
[](https://openjdk.org/)
[](http://jung.sourceforge.net/)
[](https://github.com/sauravbhattacharya001/GraphVisual/blob/master/LICENSE)
[](https://github.com/sauravbhattacharya001/GraphVisual/actions/workflows/docker.yml)
[](https://github.com/sauravbhattacharya001/GraphVisual/actions/workflows/coverage.yml)
[](https://github.com/sauravbhattacharya001/GraphVisual)
[](https://github.com/sauravbhattacharya001/GraphVisual/actions/workflows/pages.yml)
[](https://maven.apache.org/)
[](https://github.com/sauravbhattacharya001/GraphVisual/stargazers)
[](https://github.com/sauravbhattacharya001/GraphVisual/commits/master)
[](https://github.com/sauravbhattacharya001/GraphVisual/releases/latest)
[](https://github.com/sauravbhattacharya001/GraphVisual/issues)
[](https://github.com/sauravbhattacharya001/GraphVisual/graphs/contributors)
[](ALGORITHMS.md)
[](https://github.com/sauravbhattacharya001/GraphVisual/actions/workflows/publish.yml)
[](https://github.com/sauravbhattacharya001/GraphVisual/blob/master/.github/dependabot.yml)
[](Gvisual/test/)
---
## Overview
GraphVisual is a desktop application for studying **community evolution** in student populations using Bluetooth proximity data. It processes meeting records from a PostgreSQL database, classifies social relationships (friends, classmates, strangers, study groups, familiar strangers), and renders interactive graph visualizations with timeline playback.
The tool was developed for research on **social network analysis** β specifically understanding how communities form, dissolve, and evolve over time in university settings.
## Features
- **Interactive graph visualization** β Drag, zoom, rotate nodes with JUNG's built-in graph mouse
- **Timeline playback** β Animate community graphs across 92 days (MarchβMay 2011) with play/pause/stop controls
- **5 relationship categories** β Friends (green), Classmates (blue), Familiar Strangers (gray), Strangers (red), Study Groups (orange)
- **Adjustable thresholds** β Tune meeting duration and frequency thresholds per relationship type in real-time
- **Cluster-based layout** β Nodes auto-grouped into a 3Γ3 grid by relationship type, with randomized positioning
- **Edge weighting** β Line thickness reflects interaction frequency Γ duration
- **New member highlighting** β Nodes appearing for the first time are drawn larger
- **Notes panel** β Annotate each timestamp during analysis
- **Graph export** β Save visualizations as PNG images, edge lists, and JSON (D3.js/vis.js/Cytoscape.js compatible)
- **Network statistics panel** β Real-time metrics including node/edge counts, per-category breakdowns, graph density, average/max degree, average edge weight, isolated node count, and top-3 hub nodes
- **Centrality analysis** β Compute degree, betweenness (Brandes' algorithm), and closeness centrality for all nodes. Interactive panel with metric sorting, top-10 ranking with medals, network topology classification, and per-metric averages/maximums
- **Small-world analysis** β Test whether a graph exhibits Watts-Strogatz small-world properties. Computes local/global clustering coefficients, average path length, sigma (Ο) and omega (Ο) coefficients, random/lattice baselines, and classifies networks as Small-World, Random-Like, Lattice-Like, or Disconnected
- **Subgraph extraction** β Extract focused subgraphs using a fluent builder API. Filter by edge type, weight range, degree range, k-hop neighborhood, node whitelist, or time window. Export results as CSV edge lists with retention statistics and edge type breakdowns
- **Community detection** β Interactive browser tool with 4 algorithms (Louvain modularity, Label Propagation, Girvan-Newman edge betweenness, Spectral Bisection). 6 preset graphs (Karate Club, Barbell, Caveman, SBM, Ring of Cliques), force-directed layout with adjustable parameters, color-coded communities, modularity scoring, per-community density stats, drag-to-move nodes, pan/zoom, JSON/SVG export
- **Network flow visualizer** β Interactive browser tool for max-flow / min-cut visualization with Edmonds-Karp and Ford-Fulkerson algorithms. Step-by-step animation, 5 preset networks (simple, diamond, bipartite matching, complex, bottleneck), canvas graph editor, min-cut highlighting, JSON/SVG export. Java `NetworkFlowExporter` class for programmatic flow computation and HTML export
- **Random graph generator** β Interactive browser tool for generating graphs using 7 classic models (ErdΕsβRΓ©nyi, BarabΓ‘siβAlbert, Watts-Strogatz, Random Geometric, Complete, Star, Ring). Force-directed layout, degree/community coloring, drag-and-zoom, degree distribution chart, real-time stats (density, clustering, diameter, components), JSON/PNG export
- **Network resilience analyzer** β Interactive browser tool for simulating targeted and random attacks on networks. 4 attack strategies (highest-degree, highest-betweenness, random, cascading with recalculation), 6 preset graphs (BarabΓ‘si-Albert, ErdΕs-RΓ©nyi, Watts-Strogatz, Star, Grid, Karate Club), real-time robustness curve plotting, R-index computation, strategy comparison overlay, step-through animation, attack log, force-directed layout with drag interaction
## Architecture
GraphVisual consists of 145 source classes (~55,000+ lines of production code, 100,000+ total with tests), 57 graph analyzers, and a Bluetooth-to-graph data pipeline. See **[ARCHITECTURE.md](ARCHITECTURE.md)** and **[ALGORITHMS.md](ALGORITHMS.md)** for full details including the analyzer reference table, design patterns, and dependency map.
```
Gvisual/src/
βββ gvisual/ # 145 classes β GUI, edge model, 57 analyzers, utilities
β βββ Main.java # Swing GUI β graph panel, timeline, controls
β βββ edge.java # Edge model (type, vertices, weight, label)
β βββ EdgeType.java # Enum β relationship categories, colors, defaults
β βββ GraphStats.java # Network metrics (density, degree, hubs)
β βββ GraphMLExporter.java # GraphML XML export
β βββ JsonGraphExporter.java # JSON export (D3.js/vis.js/Cytoscape.js compatible)
β βββ GraphGenerator.java # 10 synthetic graph topologies
β βββ GraphUtils.java # BFS, connected components, utility methods
β βββ GraphPartitioner.java # Spectral/Kernighan-Lin partitioning
β βββ ForceDirectedLayout.java # Force-directed graph layout (Barnes-Hut)
β βββ AnalysisTask.java # Async analysis with timeout/cancellation
β βββ AnalysisResult.java # Analysis result container
β β
β βββ # βββ Structural Analyzers ββββββββββββββββββ
β βββ ArticulationPointAnalyzer.java # Cut vertices/bridges (Tarjan's)
β βββ BipartiteAnalyzer.java # Bipartiteness testing + 2-coloring
β βββ ChordalGraphAnalyzer.java # Chordal graph recognition (PEO)
β βββ CliqueAnalyzer.java # Maximal cliques (Bron-Kerbosch)
β βββ CycleAnalyzer.java # Cycle detection and enumeration
β βββ EulerianPathAnalyzer.java # Euler path/circuit (Hierholzer's)
β βββ GraphComplementAnalyzer.java # Graph complement computation
β βββ GraphIsomorphismAnalyzer.java # Graph isomorphism testing
β βββ GraphIsomorphismChecker.java # VF2-inspired isomorphism (backtracking)
β βββ GraphMinorAnalyzer.java # Graph minor detection
β βββ GraphRegularityAnalyzer.java # Regularity testing
β βββ GraphSymmetryAnalyzer.java # Automorphism & symmetry analysis
β βββ LineGraphAnalyzer.java # Line graph construction + analysis
β βββ PerfectGraphAnalyzer.java # Perfect graph recognition
β βββ PlanarGraphAnalyzer.java # Planarity testing
β βββ TreeAnalyzer.java # Tree properties, LCA, diameter
β βββ TopologicalSortAnalyzer.java # Topo sort + cycle detection
β βββ StronglyConnectedComponentsAnalyzer.java # SCC (Tarjan/Kosaraju)
β β
β βββ # βββ Centrality & Ranking ββββββββββββββββββ
β βββ NodeCentralityAnalyzer.java # Degree/betweenness/closeness
β βββ EdgeBetweennessAnalyzer.java # Edge betweenness centrality
β βββ PageRankAnalyzer.java # PageRank (power iteration)
β βββ DegreeDistributionAnalyzer.java # Degree stats + power-law fitting
β βββ RichClubAnalyzer.java # Rich-club coefficient
β β
β βββ # βββ Community & Clustering ββββββββββββββββ
β βββ CommunityDetector.java # Connected component communities
β βββ LouvainCommunityDetector.java # Louvain modularity optimization
β βββ CliqueCoverAnalyzer.java # Clique cover computation
β βββ GraphClusterQualityAnalyzer.java # Cluster quality metrics
β βββ KTrussAnalyzer.java # K-truss decomposition
β βββ MotifAnalyzer.java # Network motif detection
β βββ NodeSimilarityAnalyzer.java # Jaccard/cosine node similarity
β βββ SignedGraphAnalyzer.java # Signed graph balance theory
β βββ StructuralHoleAnalyzer.java # Burt's structural holes
β β
β βββ # βββ Optimization & NP-hard ββββββββββββββββ
β βββ BandwidthMinimizer.java # Graph bandwidth minimization
β βββ ChromaticPolynomialCalculator.java # Chromatic polynomial (deletion-contraction)
β βββ DominatingSetAnalyzer.java # Minimum dominating set
β βββ FeedbackVertexSetAnalyzer.java # Feedback vertex set
β βββ GraphColoringAnalyzer.java # Welsh-Powell vertex coloring
β βββ HamiltonianAnalyzer.java # Hamiltonian path/cycle
β βββ IndependentSetAnalyzer.java # Maximum independent set
β βββ MaxCutAnalyzer.java # Maximum cut problem
β βββ MetricDimensionAnalyzer.java # Metric dimension (resolving sets)
β βββ SteinerTreeAnalyzer.java # Steiner tree approximation
β βββ TreewidthAnalyzer.java # Treewidth estimation
β βββ VertexConnectivityAnalyzer.java # Vertex connectivity
β βββ VertexCoverAnalyzer.java # Minimum vertex cover
β β
β βββ # βββ Network Analysis ββββββββββββββββββββββ
β βββ GraphAnomalyDetector.java # Network anomaly detection
β βββ GraphNeighborhoodAnalyzer.java # k-hop neighborhood analysis
β βββ LinkPredictionAnalyzer.java # Edge prediction metrics
β βββ NetworkFlowAnalyzer.java # Max-flow/min-cut (Ford-Fulkerson)
β βββ GraphResilienceAnalyzer.java # Attack/failure resilience
β βββ GraphSparsificationAnalyzer.java # Graph sparsification algorithms
β βββ InfluenceSpreadSimulator.java # IC/LT influence models
β βββ RandomWalkAnalyzer.java # Random walks, hitting/cover times
β βββ SmallWorldAnalyzer.java # Small-world property testing (Ο, Ο)
β βββ TemporalGraph.java # Temporal graph evolution analysis
β β
β βββ # βββ Metrics & Comparison ββββββββββββββββββ
β βββ AdjacencyMatrixHeatmap.java # Adjacency matrix visualization
β βββ GraphEntropyAnalyzer.java # 9 entropy measures
β βββ GraphSimilarityAnalyzer.java # Entropy-based graph comparison
β βββ GraphDiffAnalyzer.java # Structural diff between graphs
β βββ GraphDrawingQualityAnalyzer.java # Layout quality metrics
β βββ EdgePersistenceAnalyzer.java # Edge stability over time
β βββ GrowthRateAnalyzer.java # Network growth modeling
β βββ LaplacianBuilder.java # Laplacian matrix construction
β βββ SpectralAnalyzer.java # Eigenvalue spectral analysis
β βββ GraphSpectrumAnalyzer.java # Full spectrum analysis
β βββ TournamentAnalyzer.java # Tournament graph analysis
β β
β βββ # βββ Algorithms ββββββββββββββββββββββββββββ
β βββ KCoreDecomposition.java # K-core peeling
β βββ MinimumSpanningTree.java # Kruskal's MST
β βββ ShortestPathFinder.java # BFS + weighted Dijkstra
β βββ GraphRenderers.java # Custom graph rendering
β βββ GraphDiameterAnalyzer.java # Diameter, radius, eccentricity
βββ app/ # Data pipeline β Bluetooth β meetings β edge files
βββ Network.java, Util.java, findMeetings.java, addLocation.java, matchImei.java
```
100 test classes with **2,500+ tests** cover all analyzers and utilities.
## Requirements
- **Java JDK 8** or later
- **PostgreSQL** database with the expected schema (`meeting`, `event_3`, `device_1`, `deviceID` tables)
- **Apache Ant** (NetBeans project build system)
## Setup
### 1. Clone the repository
```bash
git clone https://github.com/sauravbhattacharya001/GraphVisual.git
cd GraphVisual
```
### 2. Configure database credentials
GraphVisual reads credentials from environment variables (no hardcoded secrets):
```bash
export DB_HOST=localhost # PostgreSQL host (default: localhost)
export DB_USER=your_user # Required
export DB_PASS=your_pass # Required
```
### 3. Build
```bash
cd Gvisual
ant build
```
Or compile manually:
```bash
cd Gvisual
mkdir -p build/classes
find src -name '*.java' > sources.txt
javac -cp "$(find lib -name '*.jar' | tr '\n' ':')" -d build/classes @sources.txt
```
### 4. Run the data pipeline
Execute these in order to populate the meeting database:
```bash
# Step 1: Match device nodes to IMEIs
java -cp "build/classes:lib/*" app.matchImei
# Step 2: Extract meetings from Bluetooth events
java -cp "build/classes:lib/*" app.findMeetings
# Step 3: Classify meeting locations
java -cp "build/classes:lib/*" app.addLocation
```
### 5. Launch the visualizer
```bash
java -cp "build/classes:lib/*" gvisual.Main
```
## GUI Components
| Component | Description |
|-----------|-------------|
| **Image Panel** | Main graph canvas powered by JUNG. Supports drag, zoom, and rotation. |
| **Timeline Panel** | Slider (days 1β92) with play/pause/stop and skip controls. Speed adjustable. |
| **Toolbar** | Left-side tools for interaction mode (transform vs. pick), image/edge-list export. |
| **Category Panel** | Toggle visibility of each relationship type. Expand to adjust duration/frequency thresholds. |
| **Notes Pane** | Free-text area for annotating the currently viewed graph timestamp. |
| **Statistics Panel** | Live network metrics β node/edge counts, density, degree stats, and hub identification. |
| **Centrality Panel** | Compute and rank nodes by degree, betweenness, and closeness centrality with sortable metric selector. |
## Relationship Classification
| Type | Color | Location | Duration Threshold | Meeting Count |
|------|-------|----------|--------------------|---------------|
| **Friends** | π’ Green | Public areas | > 10 min | β₯ 2/day |
| **Classmates** | π΅ Blue | Classrooms | > 30 min | β₯ 1/day |
| **Study Groups** | π Orange | Classrooms | > 20 min | β€ 1/day |
| **Familiar Strangers** | βͺ Gray | Public/paths | < 2 min | > 1/day |
| **Strangers** | π΄ Red | Public/paths | < 2 min | < 2/day |
All thresholds are adjustable at runtime via the Category Panel sliders.
## Tech Stack
| Technology | Purpose |
|------------|---------|
| **Java 8+** | Application language |
| **JUNG 2.0.1** | Graph data structures and visualization |
| **Swing** | Desktop GUI framework |
| **PostgreSQL** | Meeting and Bluetooth event storage |
| **Apache Ant** | Build system (NetBeans) |
| **Commons IO** | File I/O utilities |
| **Java3D** | 3D graph rendering support |
| **JUnit 4** | Unit testing framework |
| **GitHub Actions** | CI/CD (build + test on JDK 11/17) |
| **CodeQL** | Automated security scanning |
## Testing
Run tests with JUnit 4:
```bash
cd Gvisual
mkdir -p build/test/classes
# Download JUnit (if not present)
curl -sL -o lib/test/junit-4.13.2.jar \
https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
curl -sL -o lib/test/hamcrest-core-1.3.jar \
https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
# Compile and run
find test -name '*.java' > test-sources.txt
javac -cp "build/classes:$(find lib -name '*.jar' | tr '\n' ':')" \
-d build/test/classes @test-sources.txt
java -cp "build/classes:build/test/classes:$(find lib -name '*.jar' | tr '\n' ':')" \
org.junit.runner.JUnitCore app.UtilMethodsTest gvisual.EdgeTest
```
## Maven / GitHub Packages
GraphVisual is published to [GitHub Packages](https://github.com/sauravbhattacharya001/GraphVisual/packages) as a Maven artifact. You can use it as a library dependency or download the fat JAR directly.
### Add as a Maven dependency
1. Configure GitHub Packages in your `~/.m2/settings.xml`:
```xml
github
YOUR_GITHUB_USERNAME
YOUR_GITHUB_TOKEN
```
2. Add the repository and dependency to your `pom.xml`:
```xml
github
https://maven.pkg.github.com/sauravbhattacharya001/GraphVisual
com.github.sauravbhattacharya001
graphvisual
1.1.0
```
### Download the fat JAR
Each [release](https://github.com/sauravbhattacharya001/GraphVisual/releases) includes a standalone `graphvisual-*-all.jar` with all dependencies bundled:
```bash
java -jar graphvisual-1.1.0-all.jar
```
### Build with Maven locally
```bash
# Install vendored local JARs first
mvn initialize -P install-local-deps
# Build the project
mvn package -B
```
## Docker
### Build
```bash
docker build -t graphvisual .
```
### Run with X11 (Linux/macOS β GUI mode)
```bash
# Allow X11 forwarding
xhost +local:docker
docker run --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
graphvisual
```
### Pull from GitHub Container Registry
```bash
docker pull ghcr.io/sauravbhattacharya001/graphvisual:latest
```
> **Note:** The Dockerfile builds a fat JAR with all dependencies, compiles source, runs tests during build, and packages a minimal JRE-based runtime image (~300MB). X11 libraries are included for optional GUI support via display forwarding.
## Quick Start β No Database Required
You can explore GraphVisual's 43 analyzers using the built-in **synthetic graph generators** without any database setup:
```java
import gvisual.GraphGenerator;
// Generate a 100-node scale-free network (BarabΓ‘si-Albert)
var graph = GraphGenerator.barabasiAlbert(100, 3);
// Or try other topologies:
// GraphGenerator.erdosRenyi(50, 0.15)
// GraphGenerator.wattsStrogatz(60, 6, 0.3)
// GraphGenerator.complete(20)
// GraphGenerator.star(30)
// GraphGenerator.grid(8, 8)
```
Then run any analyzer:
```java
import gvisual.*;
var centrality = new NodeCentralityAnalyzer();
var result = centrality.analyze(graph);
System.out.println(result);
var smallWorld = new SmallWorldAnalyzer();
System.out.println(smallWorld.analyze(graph));
```
## Analyzer Categories
| Category | Count | Highlights |
|----------|-------|------------|
| **Structural** | 12 | Cliques, cycles, planarity, isomorphism, articulation points |
| **Centrality & Ranking** | 3 | PageRank, degree/betweenness/closeness, degree distribution |
| **Community & Clustering** | 4 | Community detection, motifs, structural holes, signed graphs |
| **NP-hard Optimization** | 11 | Graph coloring, Hamiltonian paths, vertex cover, max cut |
| **Network Analysis** | 8 | Max-flow, influence spread, random walks, resilience testing |
| **Metrics & Comparison** | 8 | Spectral analysis, entropy, graph diff, edge persistence |
See **[ALGORITHMS.md](ALGORITHMS.md)** for the complete reference with time complexities and algorithm details.
## Research Context
This project was built to study **community evolution in student social networks** using Bluetooth proximity sensing. Key research questions:
- How do social communities form and evolve over a semester?
- What distinguishes friends from familiar strangers based on meeting patterns?
- How do physical spaces (classrooms vs. public areas) shape community structure?
The visualization tool enables researchers to explore these questions interactively by adjusting relationship parameters and observing how graph structures change over time.
## Contributing
Contributions are welcome! See **[CONTRIBUTING.md](CONTRIBUTING.md)** for full details on:
- Development setup and building
- Code style and architecture overview
- Testing guidelines
- Pull request process and commit conventions
Quick start: fork β branch β make changes with tests β submit PR.