Description
The Modularity function uses a clustering algorithm to detect communities in networks (graphs). The function needs no prior knowledge or estimation of starting cluster centers and assumes no particular data distribution of the input data set.
Usage
td_modularity_mle (
vertices.data = NULL,
edges.data = NULL,
sources.data = NULL,
target.key = NULL,
edge.weight = NULL,
community.association = NULL,
resolution = 1,
seed = 1,
accumulate = NULL,
vertices.data.sequence.column = NULL,
edges.data.sequence.column = NULL,
sources.data.sequence.column = NULL,
vertices.data.partition.column = NULL,
edges.data.partition.column = NULL,
sources.data.partition.column = NULL
)
Arguments
vertices.data |
Required Argument. |
vertices.data.partition.column |
Required Argument. |
edges.data |
Required Argument. |
edges.data.partition.column |
Required Argument. |
sources.data |
Optional Argument. |
sources.data.partition.column |
Optional Argument. Required when "sources.data" argument is specified. |
target.key |
Required Argument. |
edge.weight |
Optional Argument. |
community.association |
Optional Argument. |
resolution |
Optional Argument. |
seed |
Optional Argument.
Deeper analysis of the graph can improve community formation, but can also
increase execution time. |
accumulate |
Optional Argument. |
vertices.data.sequence.column |
Optional Argument. |
edges.data.sequence.column |
Optional Argument. |
sources.data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_modularity_mle" which is a
named list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator
using the following names:
community.edge.data
-
output
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Load example data.
# The examples use a graph in which nodes represent persons who are geographically distributed
# across the United States and are connected on an online social network, where they follow
# each other.
# The directed edges start at the follower and end at the leader.
loadExampleData("modularity_example", "friends", "followers_leaders")
# Create object(s) of class "tbl_teradata".
friends <- tbl(con, "friends")
followers_leaders <- tbl(con, "followers_leaders")
# Example 1 - Unweighted Edges.
# Followers follow leaders with equal intensity (all edges have default weight 1).
td_modularity_mle_out1 <- td_modularity_mle(vertices.data = friends,
vertices.data.partition.column = c("friends_name"),
edges.data = followers_leaders,
edges.data.partition.column = c("follower"),
target.key = c("leader"),
accumulate = c("friends_name","location"),
community.association = "group_id"
)
# Example 2 - Weighted Edges and Community Edge Table.
# Followers follow leaders with different intensity.
td_modularity_mle_out2 <- td_modularity_mle(vertices.data = friends,
vertices.data.partition.column = c("friends_name"),
edges.data = followers_leaders,
edges.data.partition.column = c("follower"),
target.key = c("leader"),
accumulate = c("friends_name","location"),
edge.weight = "intensity",
community.association = "group_id"
)