Description Usage Arguments Value Examples
View source: R/computeGraphClusters.R
Graph clustering (or decomposition) divides graph into
set of subgraphs that span whole graph. Depending on the type
argument
the subgraphs coudl be either nonintersecting or overlapping.
Available types of decomposition include finding connected
componenets, modularity clustering.
1 2 3 4 5 
channel 
connection object as returned by 
graph 
an object of class 
type 
specifies type of clustering or community detection to perform. 
createMembership 
logical indicates if vertex cluster membership table should be created (see 
includeMembership 
logical indicates if result should contain vertex cluster membership information. Currently,
only supported when 
weight 
logical or character: if logical then 
vertexWhere 
optionally, a 
edgeWhere 
optionally, a 
distanceTableName 
this table will contain distances between vertices (or other corresponding metrics associated with
community detection algorithm chosen). By default, random table name that begins with 
membershipTableName 
when 
schema 
name of Aster schema for the table name arguments 
allTables 
prebuilt information about existing tables. 
test 
logical: if TRUE show what would be done, only (similar to parameter 
... 
other arguments passed on to Aster graph functions except for 
computeGraphClusters
returns an object of class "toacommunities"
(compatible with
both class "communities"
and the value returned by clusters

all from the package igraph). It is a list with the following components:
membership
numeric vector giving the cluster (component or community) id to which each vertex belongs.
csize
and sizes
numeric vector giving the sizes of the clusters.
no
and length
numeric constant, the number of clusters.
algorithm
gives the name of the algorithm that was used to calculate the community structure.
id
integer vector of cluster ids from 1 to number no
.
componentid
character vector of cluster names (or component ids) where names are derived from the cluster elements and naming convention differs for each community type.
distance
numeric vector of average distances within clusters.
diameter
numeric vector of the maximum distances with clusters.
graph
original graph object that identifies a graph for which clusters are crated.
weight
see argument weight
above.
vertexWhere
see argument vertexWhere
above.
edgeWhere
see argument edgeWhere
above.
distanceTableName
Aster table name containing graph distances (applies to connected components only).
membershipTableName
(optional) Aster table name containing graph vertex to cluster memberships.
time
An object of class proc_time
with user, system, and total elapsed times
for the computeGraphClusters
function call.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  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")
# compute connected components for certain type of subgraph that
# includes only verteics that start with the letters
communities2 = computeGraphClusters(conn, policeGraphUn, type="connected", membership = TRUE,
distanceTableName = "public.shortestpathdistances",
vertexWhere = "officer ~ '[AZ].*'",
edgeWhere = "weight > 0.36")
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.