Method: Bio::Pathway#cliquishness

Defined in:
lib/bio/pathway.rb

#cliquishness(node) ⇒ Object

Returns completeness of the edge density among the surrounded nodes.

Calculates the value of cliquishness around the ‘node’. This value indicates completeness of the edge density among the surrounded nodes.

Note: cliquishness (clustering coefficient) for a directed graph is also calculated. Reference: en.wikipedia.org/wiki/Clustering_coefficient

Note: Cliquishness (clustering coefficient) for a node that has only one neighbor node is undefined. Currently, it returns NaN, but the behavior may be changed in the future.



388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/bio/pathway.rb', line 388

def cliquishness(node)
  neighbors = @graph[node].keys
  sg = subgraph(neighbors)
  if sg.graph.size != 0
    edges = sg.edges
    nodes = neighbors.size
    complete = (nodes * (nodes - 1))
    return edges.quo(complete)
  else
    return 0.0
  end
end