graphComponents: Find clusters, and return node characteristics.

View source: R/betaMix.R

graphComponentsR Documentation

Find clusters, and return node characteristics.

Description

Take an adjacency Matrix as input and find clusters. For each node, find the degree and clustering coefficient (CC). Then, calculate a centrality measure (type\*CC+1)\*deg. For type=0, it's just the degree. Note that setting type=1 means that we assign a higher value to nodes that not only have many neighbors, but the neighbors are highly interconnected. For example, suppose we have two components with k nodes, one has a star shape, and the other is a complete graph. With type=0 both graphs will get the same value, but with type=1 the complete graph will be picked by the algorithm first. Setting type to a negative value gives CC\*deg as the centrality measure.

Usage

graphComponents(A, minCtr = 5, type = 1)

Arguments

A

An adjacency Matrix(0/1).

minCtr

The minimum centrality value to be considered for a cluster center (default=5).

type

Determines how the centrality measure is computed.

Value

A data frame with the following columns:

  • labels Node label (e.g. gene names).

  • degree Node degree.

  • cc Node clustering coefficient.

  • ctr Node centrality measure: (type\*CC+1)\*deg, or CC\*deg if type is negative.

  • clustNo Cluster number.

  • iscenter 1 for the node was chosen as the cluster's center, 0 otherwise.

  • intEdges Number of edges from the node to nodes in the same cluster.

  • extEdges Number of edges from the node to nodes NOT in the same cluster.

  • distCenter Standardized Manhattan distance to the central node.

Examples

## Not run: 
   data(SIM,package = "betaMix")
   res <- betaMix(betaMix::SIM, maxalpha = 1e-6,ppr = 0.01,subsamplesize = 30000, ind=TRUE)
   adjMat <- getAdjMat(res)
   SimComp <- graphComponents(adjMat)
   head(SimComp)

## End(Not run)

haimbar/betaMix documentation built on Jan. 3, 2023, 12:54 p.m.