Learn R Programming

toaster (version 0.5.5)

computeGraphHistogram: Compute various statistic distributions on graph edges and vertices.

Description

Compute various statistic distributions on graph edges and vertices.

Usage

computeGraphHistogram(channel, graph, type = "degree", weight = FALSE, binMethod = "manual", numbins = NULL, binsize = NULL, startvalue = NULL, endvalue = NULL, vertexWhere = graph$vertexWhere, edgeWhere = graph$edgeWhere, allTables = NULL, test = FALSE, ...)

Arguments

channel
connection object as returned by odbcConnect
graph
an object of class 'toagraph' referencing graph tables in Aster database.
type
choose between graph measures to compute histogram distribution for: 'degree', 'clustering', 'shortestpath', 'pagerank', 'betweenness', 'eigenvector'.
weight
logical or character: if logical then TRUE indicates using 'weight' edge attribute, otherwise no weight used. If character then use as a name for the edge weight attribute. The edge weight may apply with types 'clustering', 'shortestpath' and centrality measures.
binMethod
one of several methods to determine number and size of bins: 'manual' indicates to use paramters below, both 'Sturges' or 'Scott' will use corresponding methods of computing number of bins and width (see http://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width).
numbins
number of bins to use in histogram.
binsize
size (width) of discrete intervals defining histogram (all bins are equal).
startvalue
lower end (bound) of values to include in histogram.
endvalue
upper end (bound) of values to include in histogram.
vertexWhere
SQL WHERE clause limiting data from the vertex table. This value when not null overrides corresponding value vertexWhere from graph (use SQL as if in WHERE clause but omit keyword WHERE).
edgeWhere
SQL WHERE clause limiting data from the edge table. This value when not null overrides corresponding value edgeWhere from graph (use SQL as if in WHERE clause but omit keyword WHERE).
allTables
pre-built information about existing tables.
test
logical: if TRUE show what would be done, only (similar to parameter test in RODBC functions: sqlQuery and sqlSave).
...
other arguments passed on to Aster graph functions except for EDGEWEIGHT argument - use argument weight instead. Aster function areguments are not casesensetive

Examples

Run this code
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