R/getSubgraphs.R

Defines functions getLargestSubgraph

Documented in getLargestSubgraph

getLargestSubgraph <- function(g){
  if(class(g) != "graphNEL"){
    stop("g needs to be of type graphNEL")
  }
  stopifnot(.validateGraph(g))
  
  cc.g <- connectedComp(g)
  cclens.g <- sapply(cc.g, length)
  #print("Subgraph distribution:")
  #print(table(cclens.g))
  ord.g <- order(cclens.g, decreasing=T)
  return(subGraph(cc.g[[ord.g[1]]], g))
}

Try the QuACN package in your browser

Any scripts or data that you put into this service are public.

QuACN documentation built on May 2, 2019, 8:18 a.m.