computeGraphClustersAsGraphs: Creates list of graphs for each specified component.

Description Usage Arguments Value Examples

View source: R/computeGraphClusters.R

Description

Based on the decomposition specified by communities object (see computeGraphClusters) materiazlies produced clusters as graph objects from Aster graph tables.

Usage

1
2
computeGraphClustersAsGraphs(channel, communities, ids = NULL,
  componentids = NULL, allTables = NULL, test = FALSE, parallel = FALSE)

Arguments

channel

connection object as returned by odbcConnect.

communities

community object returned by computeGraphClusters.

ids

integer vector with cluster integer ids (from 1 to N, where N is the number of clusters). At least one value for this or componentids must be specified.

componentids

character vector with cluster component ids assigned during community generation with computeGraphClusters. These component ids are derived from one of the vertex name (likely first vertex when ordered alphabetically). At least one value for this or ids must be specified.

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).

parallel

logical: enable parallel calls to Aster database. This option requires parallel backend enabled and registered (see in examples). Parallel execution requires ODBC channel obtained without explicit password: either with odbcConnect(dsn) or odbcDriverConnect calls, but not with odbcConnect(dsn, user, password).

Value

list of network objects materializing specified clusters (communities) represented by communities object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
if(interactive()) {

# undirected graph
policeGraphUn = toaGraph("dallaspolice_officer_vertices", "dallaspolice_officer_edges_un", 
     directed = FALSE, key = "officer", source = "officer1", target = "officer2", 
     vertexAttrnames = c("offense_count"), edgeAttrnames = c("weight"))
     
communities = computeGraphClusters(conn, policeGraphUn, type="connected", 
                                   createMembership = TRUE, includeMembership = TRUE,
                                   distanceTableName = "public.shortestpathdistances",
                                   membershipTableName = "public.clustermembership")
                                   
# get first 5 largest connected components as graphs
cluster_graphs = computeGraphClustersAsGraphs(conn, communities = communities, ids = 1:5)

# visualize component 2
library(GGally)
ggnet2(cluster_graphs[[2]], node.label="vertex.names", node.size="offense_count", 
       node.color="color", legend.position="none")

}  
  

toaster documentation built on May 30, 2017, 3:51 a.m.