Spatial Networks
Spatial Networks
Spatial Networks
1
28-10-2023
2
28-10-2023
Fig 1
3
28-10-2023
• Road Network
1. Find shortest path from my current location to a destination.
2. Find nearest hospital by distance along road networks.
3. Find shortest route to deliver goods to a list of retail stores.
4. Allocate customers to nearest service center using distance along
roads
4
28-10-2023
5
28-10-2023
2 1
12
3 5 14
13
6 4 18
Fig 3 8
15 17
7 16
9
10 11
6
28-10-2023
7
28-10-2023
Fig 2
Destination
1 2 3 4 5
1 1 0 1 0 1 0 1 2 4
2 0 0 1 1 0 2 3 4
source
5 2 3 0 0 0 0 0 3 N
4 0 0 0 0 1 4 5
4
3 5 1 0 0 0 0 5 1
(0,0)
(a) (b) Adjacency-matrix (c) Adjacency-List
8
28-10-2023
(c) Transitive closure (G) Graph Gⴱ (d) Transitive closure in relational form
9
28-10-2023
10
28-10-2023
3 5 14
13
6 4 18
8
15 17
7 16
9
Fig 3 10 11
11
28-10-2023
Case Studies
12
28-10-2023
Case Studies
Focus on concepts
• Not on procedural details !
13
28-10-2023
1
•Breadth first search -
•Visit descendent by generation 5 BFS
•children before grandchildren 1 2 4 3 5
2
•Example: 1 - (2,4) - (3, 5) 4
Fig. 6
14
28-10-2023
Figure 2
Fig 2
Destination
1 2 3 4 5
1 1 0 1 0 1 0 1 2 4
2 0 0 1 1 0 2 3 4
source
5 2 3 0 0 0 0 0 3 N
4 0 0 0 0 1 4 5
4
3 5 1 0 0 0 0 5 1
(0,0)
(a) (b) Adjacency-matrix (c) Adjacency-List
15
28-10-2023
16
28-10-2023
Fig 7(a)
17
28-10-2023
Fig 7(b)
Fig 8(a)
18
28-10-2023
Hierarchical Routing-Step 3
Step 3: Expand Boundary Path: (Ba1,Bd) -> Ba1 Bda2 Ba3 Bda4…Bd
Boundary Edge (Bij,Bj) ->fragment path (Bi1,N1N2N3…….Nk,Bj)
Fig 8(a)
Problem Statement
Given a spatial network
Find efficient data-structure to store it on disk sectors
Goal - Minimize I/O-cost of operations
• Find(), Insert(), Delete(), Create()
• Get-A-Successor(), Get-Successors()
Constraints
• spatial networks are much larger than main memories
Problems with Geometric indices, e.g. R-tree
clusters objects by proximity not edge connectivity
Performs poorly if edge connectivity not correlated with proximity
Trends: graph based methods
19
28-10-2023
Insight: 3
1
6 () (1, 5)
20
28-10-2023
Fig 10 Fig 11
Fig 12
•Storage method idea
• Divide nodes into sectors Key 0 Node 0
• to maximize CRR Key 1
Key 2
Node 1
Node 4
•Use a secondary index 0, 3 1, 3 2, 3 3, 3 Key 3
Key 4
Node 5
5 7 13 15
•for find() 0, 2 1, 2 2, 2 3, 2
Key 5
Key 6
Node 2
Node 3
•using R-tree or B-tree 4 6 12 14
Key 7
Key 7
Node 8
0, 1 1, 1 2, 1 3, 1 Node 9
•Example: Figure 12 1 3 9 11
•left part : node division 0, 0 1, 0 2, 0 3, 0 Key 8
Node 6
Key 9 Node 7
•right part 0 2 8 10
Key 10 Node 12
Key 11 Node 13
•disk sectors Key 12
Key 13
•secondary index Node (x, y) Key 14
Node 10
Node 11
Sample Network Edge Key 15
•B-tree/Z-order Node 14
Node 15
B tree (secondary index) Data Page
21
28-10-2023
Summary
Spatial Networks are a fast growing applications of SDBs
Spatial Networks are modeled as graphs
Graph queries, like shortest path, are transitive closure
not supported in relational algebra
SQL features for transitive closure: CONNECT BY, WITH RECURSIVE
Graph Query Processing
Building blocks - connectivity, shortest paths
Strategies - Best first, Dijktra’s and Hierachical routing
Storage and access methods
Minimize CRR
22