그래프 거리 vs. 지리적 거리 비교

사례 연구: R로 하는 네트워크 분석

Edmund Hart

Instructor

사례 연구: R로 하는 네트워크 분석

그래프 거리

farthest_vertices(trip_g_simp)
$vertices
+ 2/300 vertices, named, from 20dcfff:
[1] 336 340

$distance
[1] 5
get_diameter(trip_g_simp)
+ 4/300 vertices, named, from 20dcfff:
[1] 336 267 76  340
사례 연구: R로 하는 네트워크 분석

사례 연구: R로 하는 네트워크 분석

지리적 거리

library(geosphere)

# Get the to stations coordinates st_to <- bike_dat %>% filter(from_station_id == 336) %>% sample_n(1) %>% select(from_longitude, from_latitude) # Get the from stations coordinates st_from <- bike_dat %>% filter(from_station_id == 340) %>% sample_n(1) %>% select(from_longitude, from_latitude)
# find the geographic distance farthest_dist <- distm(st_from, st_to, fun = distHaversine) farthest_dist
[1, ] 13660.66
사례 연구: R로 하는 네트워크 분석

지리적 거리

bike_dist <- function(station_1, station_2, divy_bike_df){
    st1 <- divy_bike_df %>% 
                filter(from_station_id == station_1) %>% 
                sample_n(1) %>% 
                select(from_longitude, from_latitude)
    st2 <- divy_bike_df %>%
                filter(from_station_id == station_2) %>% 
                sample_n(1) %>% 
                select(from_longitude, from_latitude)

    farthest_dist <- distm(st1, st2, fun = distHaversine)
    return(farthest_dist)
}
사례 연구: R로 하는 네트워크 분석

연습해 봅시다!

사례 연구: R로 하는 네트워크 분석

Preparing Video For Download...