Documentation
Learn how to use LaNet-vi for network visualization and analysis. From basic usage to advanced API integration.
Table of Contents
Getting Started
LaNet-vi is a web-based tool for visualizing large-scale networks using k-core decomposition. It reveals the hierarchical structure of networks by identifying dense cores and peripheral nodes.
Quick Start
- Upload your network data: Drag and drop an edge list file onto the upload area
- Configure visualization: Adjust parameters like decomposition method, colors, and resolution
- Generate visualization: Click "Create Visualization" to process your network
- Download results: Save the generated image and explore network statistics
K-Core Concepts
Understanding k-core decomposition is key to interpreting LaNet-vi visualizations.
What is K-Core Decomposition?
A k-core is a maximal subgraph where every node has at least k neighbors within the subgraph. K-core decomposition reveals the hierarchical structure of networks:
- Core nodes (high k): Densely connected, resilient to removal
- Peripheral nodes (low k): Loosely connected, easily disconnected
- Shell structure: Nodes are organized in nested shells from 1-core to max k-core
Decomposition Methods
K-Cores
Based on node degree. Fast and simple, works well for most networks.
K-Dense
Based on triangle density. Better for social networks and clustered graphs.
D-Cores
Based on shortest path distances. Useful for geographic or spatial networks.
Data Formats
LaNet-vi accepts network data in edge list format. Each line represents an edge between two nodes.
Basic Edge List
1 2 # Alice connects to Bob
2 3 # Bob connects to Charlie
3 4 # Charlie connects to Dana
1 4 # Alice connects to Dana
2 4 # Bob connects to Dana
Weighted Edge List
1 2 0.5 # Alice-Bob: moderate collaboration
2 3 1.2 # Bob-Charlie: strong collaboration
3 4 0.8 # Charlie-Dana: good collaboration
1 4 2.1 # Alice-Dana: very strong collaboration
Directed Networks
# Format: source target [weight]
paper1 paper2 # paper1 cites paper2
paper1 paper3
paper2 paper4
paper3 paper4
Large Networks with Node Names
# Create separate mapping file (optional)
1001 1002
1001 1003
1002 1004
# File: node_names.txt
# 1001 University_A
# 1002 University_B
Supported File Types
.txt- Plain text files.txt.gz- Gzip compressed text files.txt.bz2- Bzip2 compressed text files
Configuration Options
Customize your visualization with various parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Decomposition Method | Select | K-Cores | Algorithm for network decomposition |
| Output Format | Select | PNG | Image format (PNG, PDF, SVG) |
| Background | Select | White | Background color |
| Resolution | Slider | 2400x2400 | Image resolution in pixels |
| Node Size | Slider | 1.0 | Node size multiplier |
| Edge Transparency | Slider | 0.5 | Edge opacity (0.1 to 1.0) |
API Reference
LaNet-vi provides a REST API for programmatic access to network visualization capabilities. All endpoints require authentication via API token.
Authentication
Include your API token in requests using one of these methods:
Authorization: Bearer YOUR_API_TOKEN
# Query parameter
?token=YOUR_API_TOKEN
# Request body (JSON)
{"token": "YOUR_API_TOKEN", ...}
API Endpoints
/api/infoGet API information (no authentication required)
/api/uploadUpload network file for processing
/api/visualizeCreate visualization from uploaded file
/api/analyze-networkAnalyze network structure without visualization
/api/locate-ipLocate IP address in internet topology
/api/download/<filename>Download generated visualization files
Security Features
- Token Authentication: All API endpoints require a valid API token
- Multiple Auth Methods: Bearer token, query parameter, or request body
- Rate Limiting: 10 requests/minute, 100 requests/hour per IP
- Server-side Processing: All file processing happens securely server-side
- File Validation: Comprehensive input validation and sanitization
Rate Limits
- 10 requests per minute per IP
- 100 requests per hour per IP
Usage Examples
Python API Usage
# Set up authentication
headers = {'Authorization': 'Bearer YOUR_API_TOKEN'}
# Upload file
with open('network.txt', 'rb') as f:
response = requests.post('http://localhost:8890/api/upload',
files={'file': f}, headers=headers)
job_id = response.json()['job_id']
# Create visualization
config = {
'job_id': job_id,
'config': {
'decomp_type': 'kcores',
'resolution': 2400,
'background': 'white'
}
}
response = requests.post('http://localhost:8890/api/visualize',
json=config, headers=headers)
image_url = response.json()['image_url']
JavaScript API Usage
const headers = {
'Authorization': 'Bearer YOUR_API_TOKEN'
};
// Upload file
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const uploadResponse = await fetch('/api/upload', {
method: 'POST',
body: formData,
headers: headers
});
const {job_id} = await uploadResponse.json();
// Create visualization
const config = {
job_id: job_id,
config: {decomp_type: 'kcores'}
};
const vizResponse = await fetch('/api/visualize', {
method: 'POST',
headers: {...headers, 'Content-Type': 'application/json'},
body: JSON.stringify(config)
});
const {image_url} = await vizResponse.json();
Troubleshooting
Common Issues
- Check file size (max 50MB)
- Ensure file format is supported (.txt, .txt.gz, .txt.bz2)
- Verify network connection
- Try a smaller test file first
- Large networks (>100k nodes) require more processing time
- Try reducing resolution for faster processing
- Consider using k-cores instead of k-dense for large networks
- Check server load and try again later
- Ensure each line has at least two columns (source target)
- Remove headers or non-numeric node IDs
- Check for special characters or encoding issues
- Use integer node IDs starting from 0 or 1
Need more help?
For additional support, please check the LaNet-vi GitHub repository or contact the development team.