if(interactive()) {
policeGraphUn = toaGraph("dallaspolice_officer_vertices", "dallaspolice_officer_edges_un",
directed = FALSE, key = "officer",
source = "officer1", target = "officer2",
vertexAttrnames = c("offense_count"), edgeAttrnames = c("weight"))
# initialize connection to Lahman baseball database in Aster
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")
hdegreePolice = computeGraphHistogram(conn, policeGraphUn, type='degree', numbins=36)
createHistogram(hdegreePolice,
title = "Dallas Police Graph Degree Distribution",
xlab='Degree', ylab='Count')
hshortestpathPolice = computeGraphHistogram(conn, policeGraphUn, type='shortestpath',
numbins = 10)
createHistogram(hshortestpathPolice,
title = "Dallas Police Shortest Path Distribution",
xlab = "Distance", ylab = "Count")
}
Run the code above in your browser using DataLab