clique

R igraph find all maximal cliques without overlapping

六眼飞鱼酱① 提交于 2020-07-10 09:26:05
问题 I am trying to find all maximal cliques in a graph, without overlapping. the function max_cliques() returns all possible maximal cliques in the graph, but I want every vertex to be included in only one clique- in the largest clique it can be part of. for example, if the output of the max_cliques() are the following cliques: {A,B,C}, {A,B,D}, {A,B,J,K}, {E,F,G,H}, {E,F,G,I} I want to remove some cliques so that all the vertexes will appear in exacly one clique, so the final set will be: {A,B,J

How to aggregate matching pairs into “connected components” in Python

十年热恋 提交于 2020-01-20 16:51:27
问题 Real-world problem: I have data on directors across many firms, but sometimes "John Smith, director of XYZ" and "John Smith, director of ABC" are the same person, sometimes they're not. Also "John J. Smith, director of XYZ" and "John Smith, director of ABC" might be the same person, or might not be. Often examination of additional information (e.g., comparison of biographical data on "John Smith, director of XYZ" and "John Smith, director of ABC") makes it possible to resolve whether two

How to aggregate matching pairs into “connected components” in Python

不想你离开。 提交于 2020-01-20 16:45:34
问题 Real-world problem: I have data on directors across many firms, but sometimes "John Smith, director of XYZ" and "John Smith, director of ABC" are the same person, sometimes they're not. Also "John J. Smith, director of XYZ" and "John Smith, director of ABC" might be the same person, or might not be. Often examination of additional information (e.g., comparison of biographical data on "John Smith, director of XYZ" and "John Smith, director of ABC") makes it possible to resolve whether two

clique number of a graph

Deadly 提交于 2020-01-15 12:09:49
问题 I would like to know a fast algorithm to find only the clique number(without actually finding the clique) of a graph with about 100 vertices. I am trying to solve the following problem. http://uva.onlinejudge.org/external/1/193.html 回答1: This is NP-complete, and you can't do it much better than actually finding the maximum clique and counting its vertices. From Wikipedia: Clique problems include: solving the decision problem of testing whether a graph contains a clique larger than N These

Finding maximal cliques and removing nodes?

核能气质少年 提交于 2019-12-23 02:32:44
问题 I am trying to find maximal cliques for a set of items. Currently I am using networkx library of python and using find_cliques() function to find all the maximal cliques as below: import newtworkx as nx G = nx.Graph() E = [[1,2], [1,3], [1,4], [2,3], [2,4], [3,4], [2,6], [2,5], [5,6]] G.add_edges_from(E) #G.edges() lst = list(nx.find_cliques(G)) lst Out [] : [[2, 1, 3, 4], [2, 5, 6]] But what I am actually expecting is to find maximal cliques and then remove the nodes which were in the

How to find pattern groups in boolean array?

与世无争的帅哥 提交于 2019-12-21 12:04:38
问题 Given a 2D array of Boolean values I want to find all patterns that consist of at least 2 columns and at least 2 rows. The problem is somewhat close to finding cliques in a graph. In the example below green cells represent "true" bits, greys are "false". Pattern 1 contains cols 1,3,4 and 5 and rows 1 and 2. Pattern 2 contains only columns 2 and 4, and rows 2,3,4. Business idea behind this is finding similarity patterns among various groups of social network users. In real world number of rows

How to find the size of maximal clique or clique number?

∥☆過路亽.° 提交于 2019-12-21 06:28:49
问题 Given an undirected graph G = G(V, E), how can I find the size of the largest clique in it in polynomial time? Knowing the number of edges, I could put an upper limit on the maximal clique size with https://cs.stackexchange.com/questions/11360/size-of-maximum-clique-given-a-fixed-amount-of-edges , and then I could iterate downwards from that upper limit to 1. Since this upper cap is O(sqrt(|E|)), I think I can check for the maximal clique size in O(sqrt(|E|) * sqrt(|E|) * sqrt(|E|)) time. Is

Reduction to Clique prob

眉间皱痕 提交于 2019-12-19 10:42:49
问题 Subgraph isomorphism We have the graphs G_1=(V_1,E_1), G_2=(V_2,E_2). Question : Is the graph G_1 isomorphic to a subgraph of G_2 ? (i.e. is there a subset of vertices of G_2, V ⊆ V_2 and subset of the edges of G_2, E ⊆ E_2 such that |V|=|V_1| and |E|=|E_1| and is there a one-to-one matching of the vertices of G_1 at the subset of vertices V of G_2, f:V_1 -> V such that {u,v} ∈ E_1 <=> { f(u),f(v) } ∈ E) Show that the problem Subgraph isomorphism belongs to NP. Show that the problem is NP

Reduction to Clique prob

爱⌒轻易说出口 提交于 2019-12-19 10:42:11
问题 Subgraph isomorphism We have the graphs G_1=(V_1,E_1), G_2=(V_2,E_2). Question : Is the graph G_1 isomorphic to a subgraph of G_2 ? (i.e. is there a subset of vertices of G_2, V ⊆ V_2 and subset of the edges of G_2, E ⊆ E_2 such that |V|=|V_1| and |E|=|E_1| and is there a one-to-one matching of the vertices of G_1 at the subset of vertices V of G_2, f:V_1 -> V such that {u,v} ∈ E_1 <=> { f(u),f(v) } ∈ E) Show that the problem Subgraph isomorphism belongs to NP. Show that the problem is NP

Implementing Bron–Kerbosch algorithm in python

旧巷老猫 提交于 2019-12-12 08:15:11
问题 for a college project I'm trying to implement the Bron–Kerbosch algorithm, that is, listing all maximal cliques in a given graph. I'm trying to implement the first algorithm (without pivoting) , but my code doesn't yield all the answers after testing it on the Wikipedia's example , my code so far is : # dealing with a graph as list of lists graph = [[0,1,0,0,1,0],[1,0,1,0,1,0],[0,1,0,1,0,0],[0,0,1,0,1,1],[1,1,0,1,0,0],[0,0,0,1,0,0]] #function determines the neighbors of a given vertex def N