Home | Trees | Indices | Help |
---|
|
Cliques - Find and manipulate cliques of graphs
Note that finding the largest clique of a graph has been shown to be an NP complete problem so the algorithms here could take a LONG time to run. In practice it hasn't been too bad for the graphs tested.
Date: $Date: 2005-06-15 07:56:03 -0600 (Wed, 15 Jun 2005) $
Author: Dan Schult (dschult@colgate.edu)
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
__credits__ =
|
|||
__revision__ =
|
|
Find_cliques algorithm based on Bron & Kerbosch This algorithm searchs for maximal cliques in a graph. maximal cliques are the largest complete subgraph containing a given point. The largest maximal clique is sometimes called the maximum clique. This algorithm produces the list of maximal cliques each of which are a list of the members of the clique. Based on Algol algorithm published by Bron & Kerbosch A C version is available as part of the rambin package. http://www.ram.org/computing/rambin/rambin.html Reference: @article{362367, author = {Coen Bron and Joep Kerbosch}, title = {Algorithm 457: finding all cliques of an undirected graph}, journal = {Commun. ACM}, volume = {16}, number = {9}, year = {1973}, issn = {0001-0782}, pages = {575--577}, doi = {http://doi.acm.org/10.1145/362342.362367}, publisher = {ACM Press}, } |
A recursive helper routine for find_cliques This recursive routine explores the "old_nodes" set of nodes for complete subgraphs. num_left is the size of old_nodes. The first num_not nodes are called the "not" group by B&K because they have already been considered. The rest (num_left-num_not) of them are called "candidates". G is the graph, clique is the clique being built, cliques is a list of maximal cliques found so far. |
Create the maximal clique graph of a graph. It finds the maximal cliques and treats these as nodes. The nodes are connected if they have common members in the original graph. Theory has done a lot with clique graphs, but I haven't seen much on maximal clique graphs. Note: This should be the same as make_clique_bipartite followed by project_up, but it saves all the intermediate stuff. |
Create a bipartite clique graph from a graph G. Nodes of G are retained as the "bottom nodes" of B and cliques of G become "top nodes" of B. Edges are present if a bottom node belongs to the clique represented by the top node. Returns a Graph with additional attribute B.node_type which is "Bottom" or "Top" appropriately. if fpos is not None, a second additional attribute B.pos is created to hold the position tuple of each node for viewing the bipartite graph. |
|
|
|
Returns the size of the largest maximal clique containing each given node. Returns a single or list depending on input nodes. Returns a dict keyed by node if "with_labels=True". Optional list of cliques can be input if already computed. |
Returns the number of maximal cliques for each node. Returns a single or list depending on input nodes. Returns a dict keyed by node if "with_labels=True". Optional list of cliques can be input if already computed. |
Returns a list of cliques containing the given node. Returns a single list or list of lists depending on input nodes. Returns a dict keyed by node if "with_labels=True". Optional list of cliques can be input if already computed. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Sun Aug 17 12:04:43 2008 | http://epydoc.sourceforge.net |