MMS-VPR / Sample dataset /04 Graph /Graph_Structure_README.md
Yiwei-Ou's picture
Upload Sample dataset/04 Graph/Graph_Structure_README.md with huggingface_hub
e113db8 verified
# Graph Structure Documentation
## Overview
The MMS-VPR dataset conceptualizes the pedestrian network as a spatial graph **G = (V, E)** where nodes represent street intersections and edges represent street segments. This graph-based organization provides:
1. **Structural clarity** for dataset navigation
2. **Foundation for GNN applications** (Graph Neural Networks)
3. **Spatial relationship modeling** for context-aware VPR
4. **Integration with urban science** through space syntax theory
The graph comprises **208 locations** organized into **four spatial types**:
- **81 Nodes**: Street intersections
- **125 Edges**: Pedestrian street segments (61 horizontal + 64 vertical)
- **2 Squares**: Large open spaces
## File Descriptions
### 00 Street Network Graph.pdf
**Visualization** of the complete pedestrian network showing:
- Geographic layout of all 208 locations
- Node positions (street intersections)
- Edge connections (street segments)
- Square boundaries
- Real-world mapping to Chengdu Taikoo Li
This map provides an intuitive understanding of:
- Spatial relationships between locations
- Network topology and connectivity
- Physical layout in the commercial district
**Use this visualization** to understand the overall dataset structure before diving into detailed data files.
---
### 01 Node Features.xlsx
**Contains**: Attributes for all 81 street intersection nodes (+ 2 squares)
#### Column Descriptions
| Column | Description | Example Values |
|--------|-------------|----------------|
| **Code** | Node identifier | `N-1-1`, `N-2-3`, `S-1` |
| **Node Type** | Classification (1-4) | `1`, `2`, `3`, `4` |
| **Location Coordinates** | Grid position (row, column) | `1, 1` → Row 1, Column 1 |
| **J-graph Depth** | Shortest path distance to public roads | `0`, `1`, `2`, `3`, `4`, `5` |
| **Longitude** | GPS longitude coordinate | `+104.081061` |
| **Latitude** | GPS latitude coordinate | `+30.658052` |
#### Node Type Classification
Nodes are classified based on **accessibility depth** (distance to public roads):
**Type 1: Gateway Nodes** (Depth 0-1)
- Located at or immediately adjacent to public roads
- Highest accessibility and visibility
- Serve as primary entry/exit points
- Characteristics: High pedestrian flow, easy wayfinding
**Type 2: Intermediate Nodes** (Depth 2-3)
- Moderately interior positions
- Balance between exposure and seclusion
- Act as conduits between entrances and deep zones
- Characteristics: Moderate flow, mixed accessibility
**Type 3: Deep Interior Nodes** (Depth 4-5)
- Deep interior locations
- Low visibility from public roads
- Lower pedestrian flow
- Higher wayfinding challenge
- Characteristics: Requires navigation through multiple turns
**Type 4: Open Squares**
- Large open spaces (S-1, S-2)
- Bounded by multiple edges and nodes
- Central gathering spaces
- Characteristics: High visibility within district, social hub
#### J-graph Depth Explanation
**Definition**: Shortest path distance (in number of street segments) from a node to the nearest public road.
- **Depth 0**: Node is ON a public road
- **Depth 1**: One street segment away from public road
- **Depth 2-3**: Interior positions requiring 2-3 turns from entrance
- **Depth 4-5**: Deep interior requiring complex navigation
This metric indicates:
- Ease of discovery by visitors
- Expected pedestrian traffic volume
- Wayfinding complexity
---
### 02 Edge Features.xlsx
**Contains**: Attributes for all 125 street segments (edges)
#### Column Descriptions
| Column | Description | Example Values |
|--------|-------------|----------------|
| **SegmentID** | Edge identifier | `Eh-1-1`, `Ev-2-3` |
| **NodeA** | Starting node | `N-1-1` |
| **NodeB** | Ending node | `N-1-2` |
| **Edge Type** | Street width classification (1-3) | `1`, `2`, `3` |
| **Location Coordinates** | Grid position | `1, 1` |
| **Orientation** | Street angle in degrees | `0` (horizontal), `90` (vertical) |
| **Length** | Physical length in meters | `53.05` |
| **Width** | Physical width in meters | `4.0` |
| **Urban Roads** | Public road indicator | `1` (public), `0` (private) |
| **Longitude** | GPS longitude of street center | `+104.082376` |
| **Latitude** | GPS latitude of street center | `+30.657317` |
| **e_loc_x** | First coordinate component | `1` |
| **e_loc_y** | Second coordinate component | `1` |
| **integration** | Space syntax integration (angular) | `0.015` |
| **betweenness** | Space syntax betweenness (angular) | `0.012` |
| **weighted_integration** | Weighted integration (angular + Euclidean) | `0.023` |
| **weighted_betweenness** | Weighted betweenness (angular + Euclidean) | `0.037` |
#### Edge Naming Convention
**Horizontal Edges** (East-West streets): `Eh-i-j`
- Example: `Eh-1-1` = Row 1, Column 1 of horizontal edges
- Orientation: 0°
**Vertical Edges** (North-South streets): `Ev-j-i`
- Example: `Ev-1-1` = Column 1, Row 1 of vertical edges
- Orientation: 90°
#### Edge Type Classification
Streets are classified by **width** following urban design principles:
**Type 1: Alley** (1-3 meters)
- Narrow passages
- Constrained flow corridors
- Primarily for connectivity
- Characteristics: Intimate scale, limited dwell potential
**Type 2: Intermediate Street** (4-7 meters)
- Comfortable circulation width
- Moderate dwell potential
- Supports walking + browsing
- Characteristics: Balanced flow and activity
**Type 3: Primary Broad Street** (8-13 meters)
- Wide open corridors
- Supports high pedestrian flow
- Suitable for events and gatherings
- Characteristics: High capacity, visual prominence
#### Urban Roads Indicator
- **1**: Public city road (district perimeter)
- **0**: Private interior street (within shopping district)
This distinguishes between:
- External connections to city street network
- Internal pedestrian-only circulation
#### Space Syntax Metrics
**Integration** (Global Accessibility)
- Measures how easily a street can be reached from all other streets
- **Higher values** → Centrally located, easily accessible streets
- **Lower values** → Peripheral or isolated streets
**Betweenness** (Through-Movement Potential)
- Measures how often a street lies on shortest paths between other streets
- **Higher values** → Primary routes with heavier pedestrian flow
- **Lower values** → Secondary streets with local traffic only
**Metric Variants**:
1. **integration / betweenness**: Based on **angular distance** only
- Angular distance = sum of turn angles / 90°
- Represents cognitive wayfinding effort
2. **weighted_integration / weighted_betweenness**: Based on **weighted distance**
- Weighted distance = 50% normalized Euclidean + 50% normalized angular
- Balances physical distance and turning complexity
- More comprehensive spatial measure
**Why Two Variants?**
- Angular metrics better predict pedestrian movement (people minimize turns)
- Weighted metrics balance physical distance with cognitive ease
- Different research questions may require different metrics
**Normalization**: All metrics are normalized to [0, 1] range for comparability.
---
### 03 Edge Connections.xlsx
**Contains**: Pairwise relationships between all connected street segments
#### Column Descriptions
| Column | Description | Example Values |
|--------|-------------|----------------|
| **Segment_X** | First street identifier | `Eh-1-1` |
| **Segment_Y** | Second street identifier | `Ev-1-1` |
| **SharedNode** | Intersection connecting X and Y | `N-1-1` |
| **Angle_X** | Orientation of street X | `0°` |
| **Angle_Y** | Orientation of street Y | `90°` |
| **TurnAngle** | Turn angle from X to Y | `90°` |
| **Angular Distance** | Normalized angular distance | `1.0` |
| **Euclidean Distance** | Physical distance (m) | `65.46` |
| **Weighted Distance** | Combined distance metric | `1.2` |
#### Distance Metrics Explained
**Turn Angle**
- Range: 0° to 180°
- Angle required to turn from street X to street Y
- Example: 90° = perpendicular turn, 180° = reverse direction
**Angular Distance**
- Formula: `TurnAngle / 90°`
- Range: 0.0 to 2.0
- Normalized cognitive cost of turning
- Example: 90° turn = 1.0, 45° turn = 0.5
**Euclidean Distance**
- Physical distance = Length(X) + Length(Y)
- Actual walking distance between street centers
- Unit: meters
**Weighted Distance**
- Combines angular and Euclidean distances
- Both components normalized to [0, 1] via min-max scaling
- Formula: `0.5 × norm(Euclidean) + 0.5 × norm(Angular)`
- Balances physical distance and turning difficulty
#### Use Cases
This file enables:
1. **Graph Construction**:
- Segment_X and Segment_Y define edge connectivity
- Build adjacency matrices for GNN input
2. **Pathfinding**:
- Use Angular Distance for cognitively easy routes
- Use Euclidean Distance for shortest physical paths
- Use Weighted Distance for balanced optimization
3. **Network Analysis**:
- Identify critical junctions (high-degree nodes)
- Analyze route options between locations
- Compute centrality measures
---
### 04 Square Features.xlsx
**Contains**: Attributes for the 2 large open square spaces
#### Column Descriptions
| Column | Description | Example Values |
|--------|-------------|----------------|
| **Square Code** | Square identifier | `S-1`, `S-2` |
| **Node Type** | Always 4 (open square) | `4` |
| **List of Adjacent Edges** | Boundary streets | `Eh-8-3, Ev-6-1, Eh-10-4` |
| **List of Adjacent Nodes** | Boundary intersections | `N-8-3, N-10-3, N-10-4` |
| **Size Rank** | Area ranking | `1` (largest), `2` |
| **J-graph Depth** | Minimum depth of adjacent nodes | `2` |
| **Longitude** | GPS longitude of square center | `+104.081061` |
| **Latitude** | GPS latitude of square center | `+30.658052` |
| **Perimeter** | Boundary length (m) | `198` |
| **Area** | Total area (m²) | `2347` |
#### Understanding Squares
Squares are **sub-graphs** defined as:
- **S_k = (E_k, V_k)** where:
- E_k ⊂ E: Subset of edges forming the boundary
- V_k ⊂ V: Subset of nodes at corners
**S-1: Central Square**
- Area: 2,347 m²
- Primary gathering space
- Highest visibility within district
- Multiple access points (edges)
**S-2: Secondary Square**
- Smaller auxiliary open space
- Complementary function to S-1
#### Adjacent Elements
**Adjacent Edges**: Streets forming the square's perimeter
- Define the boundary of the open space
- Connect the square to the rest of the network
**Adjacent Nodes**: Intersections at square corners
- Entry/exit points to the square
- Connection hubs to surrounding streets
#### J-graph Depth for Squares
- Calculated as the **minimum depth** among all adjacent nodes
- Represents the easiest path to reach the square from public roads
- Example: If adjacent nodes have depths [2, 3, 3, 4], square depth = 2
---
## Using Graph Structure in Research
### For GNN Applications
**Step 1: Build Adjacency Matrix**
```python
# Use 03 Edge Connections.xlsx
adjacency_matrix[Segment_X][Segment_Y] = 1 # Or use weighted distance
```
**Step 2: Extract Node Features**
```python
# Use 01 Node Features.xlsx and 02 Edge Features.xlsx
node_features = [depth, coordinates, integration, betweenness, ...]
```
**Step 3: Define Graph**
```python
G = (V, E, X)
V = all nodes (from 01)
E = all connections (from 03)
X = node/edge features (from 01, 02)
```
### For Spatial Analysis
**Accessibility Studies**:
- Use `integration` to identify most accessible streets
- Compare gateway nodes vs. deep interior nodes
- Analyze pedestrian flow distribution
**Route Planning**:
- Use `Angular Distance` for intuitive routes
- Use `Weighted Distance` for balanced optimization
- Consider `Edge Type` for comfort (prefer wider streets)
**Urban Design Insights**:
- Correlate `betweenness` with observed pedestrian counts
- Identify under-utilized spaces (low integration + low betweenness)
- Suggest interventions to improve connectivity
### For VPR Research
**Context-Aware Retrieval**:
- Use graph structure to constrain search space
- Prioritize neighbors in graph when matching queries
- Weight matches by spatial proximity in network
**Hierarchical Search**:
- First: Identify region using `Node Type` and `J-graph Depth`
- Then: Refine within local graph neighborhood
- Finally: Match specific location
**Flow-Aware Methods**:
- Weight locations by `integration` (high-traffic areas)
- Account for `betweenness` in query distribution
- Model expected pedestrian paths
---
## Space Syntax Theory Integration
### Background
**Space Syntax** is an established theory in urban science and architecture that quantifies spatial configuration's impact on human movement and social behavior.
**Key Insight**: The way spaces are connected (topology) influences how people move through them, independent of function or aesthetics.
### Integration Metric
**Mathematical Definition**:
$$\text{Integration}_i = \frac{k-2}{2 \left( \frac{1}{k-1} \sum_{j \neq i} d(i,j) - 1 \right)}$$
Where:
- k = total number of streets
- d(i,j) = shortest path distance from street i to street j
**Interpretation**:
- **High integration** → Street is central, easily reached from everywhere
- **Low integration** → Street is peripheral, requires many turns to access
**Practical Meaning**:
- Predicts pedestrian flow volume
- Indicates commercial potential
- Guides wayfinding difficulty
### Betweenness Metric
**Mathematical Definition**:
$$\text{Betweenness}_i = \sum_{\substack{j \neq i \\ k \neq i, k \neq j}} \frac{\sigma_{jk}(i)}{\sigma_{jk}}$$
Where:
- σ_jk = total number of shortest paths from j to k
- σ_jk(i) = number of those paths passing through i
**Interpretation**:
- **High betweenness** → Street is on many shortest paths (through-route)
- **Low betweenness** → Street is rarely on shortest paths (destination only)
**Practical Meaning**:
- Identifies primary circulation routes
- Predicts encounter probability
- Indicates strategic retail locations
### Why This Matters for VPR
Traditional VPR datasets provide only:
- Visual appearance
- GPS coordinates
MMS-VPR adds:
- **Topological context**: How is this place connected?
- **Movement potential**: How much traffic does it get?
- **Accessibility hierarchy**: How easy is it to find?
This enables:
1. **Context-aware matching**: Use spatial configuration to improve accuracy
2. **Query distribution modeling**: Account for non-uniform real-world usage
3. **Cross-city transfer**: Spatial patterns generalize across urban contexts
4. **Interpretable models**: Explain predictions using urban design theory
---
## Data Quality and Validation
### Topology Validation
**Verified Properties**:
- All edges connect exactly two nodes
- No isolated components (graph is connected)
- Coordinates match real-world positions
- Angular distances computed correctly
### Metric Computation
**Computation Tools**:
- Space syntax metrics: Computed using DepthmapX/UCL software
- Angular distance: Based on street centerline geometry
- Euclidean distance: Direct calculation from GPS + street length
**Normalization**:
- All spatial metrics: Min-max normalized to [0, 1]
- Enables fair comparison across different distance types
---
## Frequently Asked Questions
**Q: Why use graph structure for VPR?**
A: Graph structure captures spatial relationships that pure visual matching misses. It enables context-aware retrieval, handles ambiguous queries better, and improves performance in visually similar areas.
**Q: What's the difference between angular and weighted distance?**
A: Angular distance considers only turns (cognitive ease). Weighted distance balances turns and physical distance (50-50). Choose based on your application: navigation apps may prefer angular, while distance estimation needs weighted.
**Q: How do I convert location codes to indices?**
A: Each location has a unique index 0-207:
- Nodes: N-1-1 to N-9-9 → indices 0-80
- Squares: S-1, S-2 → indices 81-82
- Horizontal edges: Eh-1-1 to Eh-11-7 → indices 83-143
- Vertical edges: Ev-1-1 to Ev-7-11 → indices 144-207
See `Texts/Annotations.xlsx` for complete mapping.
**Q: Can I use only visual data without graphs?**
A: Yes! The dataset works perfectly for standard image-based VPR. Graph structure is an **additional resource** for advanced methods, not a requirement.
---
## Recommended Workflow
### For First-Time Users
1. **Start** with `00 Street Network Graph.pdf` → Understand spatial layout
2. **Read** `Texts/Annotations.xlsx` → Learn location codes
3. **Explore** one location folder in `Images/` → See actual data
4. **Review** `01 Node Features.xlsx` → Understand location attributes
5. **Try** basic image retrieval → Validate setup
### For GNN Researchers
1. **Load** `03 Edge Connections.xlsx` → Build adjacency matrix
2. **Extract** features from `01` and `02` → Create feature vectors
3. **Align** with visual features from `Images/` → Multimodal embedding
4. **Train** GNN model → Leverage graph structure
5. **Evaluate** on graph-aware metrics → Consider topological accuracy
### For Urban Analytics
1. **Analyze** `integration` and `betweenness` → Identify key streets
2. **Correlate** with image counts → Validate with actual activity
3. **Compare** `J-graph Depth` across locations → Accessibility patterns
4. **Visualize** using `00 Street Network Graph.pdf` → Present findings
---
## Version History
**v1.0** (February 2026)
- Initial release
- 208 locations (81 nodes + 125 edges + 2 squares)
- Complete space syntax metrics
- Validated graph topology
---
## Citation
When using graph structure data, please cite:
```bibtex
@article{ou2025mmsvpr,
title = {MMS-VPR: Multimodal Street-Level Visual Place Recognition Dataset and Benchmark},
author = {Ou, Yiwei and Ren, Xiaobin and Sun, Ronggui and Gao, Guansong and
Jiang, Ziyi and Zhao, Kaiqi and Manfredini, Manfredo},
journal = {arXiv preprint arXiv:2505.12254},
year = {2025},
url = {https://arxiv.org/abs/2505.12254}
}
```
## References
For more on space syntax theory:
- Hillier, B., & Hanson, J. (1984). The Social Logic of Space
- Turner, A. (2001). Angular analysis. 3rd International Symposium on Space Syntax
- Peponis, J., et al. (1997). The spatial core of urban culture
---
**For questions about graph structure, please open an issue on GitHub or contact the authors.**