Given is a bipartite graph, and we want to list all maximal complete bipartite sub-graph.
For instance,
vertex set L = {A, B, C, D}
vertex set R = {a, b, c, d, e}
edges: A-a, A-b, B-a, B-b, C-c, C-d, D-c, D-d, D-e
The maximal complete bipartite are:
{A,B}-{a, b}
{C,D}-{c, d}
{D} - {c, d, e}
I have found a brute force algorithm, O(2^n).
I don't know if some approximation algorithm or randomized algorithm.
You can transform the problem to finding maximal cliques by adding edges between every pair of vertices in each part of the bipartite graph.
The Bron-Kerbosch algorithm can be used to list all maximal cliques in a graph (not necessarily bipartite). It is pretty easy to implement and has a slightly better worst-case time bound of O(3^(n/3)). There is also a fix-parameter tractable time bound in term of the degeneracy of the graph.
Related
Assume G = (V,E) is a complete graph.
Let the vertices be a set of points in the plane and let the edges be line segments between the points. Let the weight of each edge [a, b] be the length of the segment 'ab'.
After reading about Prim's Algorithm and Kruskal's Algorithm, I have some sound knowledge that these greedy algorithms output the minimum spanning tree of a graph.
My Question is: After obtaining a minimum spanning tree of G, Is there a way to prove that the minimum spanning tree of G is a plane graph?
You can check if the minimum spanning tree is planar as any graph. There are a simple way to check if a graph is planar. The very known Euler formula
“If G is a connected planar graph with e edges and v vertices, where v >= 3, then e <= 3v - 6. Also G cannot have a vertex of degree exceeding 5.”
or you can rely on the following method:
Theorem – “Let G be a connected simple planar graph with e edges and v vertices. Then the number of faces f in the graph is equal to f = e-v+2.”
Euler also showed that for any connected planar graph, the following relationship holds:
v - e + f = 2.
Good lucky
Hello this is my first question. I met a homework in algorithm and probability that I can't find a clue to calculate.
Question:
Computing Number of Triangles in a Graph: Given an undirected graph G = (V, E), a triangle in G is a clique of size 3 (formally, a set of nodes {u, v, w} is a triangle in G if (u, v), (v, w), (u, w) are all edges of G). Consider the following algorithm for approximating the number of triangles in a graph. First construct a sampled graph G' = (V, E') as follows. The vertex set of G' is same as that of G. For every e ∈ E, put e in E' with probability p (think of p as, say, 0.1). In this new sampled graph G', count the number of triangles and let T' be the number of triangles in G' (assume that you have given a black box subroutine to count the number of triangles in G' ). Then output T̃= T'/p.
Show that the expected value of T̃=T ,T is the triangle number of original graph G.
I am confusing that the edge in G or G' to form a triangle is not independent since two adjacent triangles in G might share the edge. And not the all the pair of vertices in G can form a edge in G', only those edges are in G will be present in G' with p. It's hard for me to think of the relationship of number of edges and number of triangles in G or G'.
Hope someone can give me some hints, even not the whole solution is OK.
the edge in G or G' to form a triangle is not independent since two adjacent triangles in G might share the edge
Doesn't matter. The sum of expectations is the expectation of the sum regardless of correlation, so you can reason about the triangles individually. (Higher moments, were you concerned about analyzing the estimation quality of this algorithm, would be trickier.)
Let G = (V, E) be a directed graph, given in the adjacency list format. Define a
directed graph G' = (V, E') where an edge (u, v) ∈ E'
if and only if (v, u) ∈ E (namely, G'reverses the direction of each edge in G). Describe an algorithm to obtain an adjacency list representation
of G'
in O(|V | + |E|) time.
is there a simple way inverse the adjacency list?
say if it was:
a-> b
b-> de
c-> c
d-> ab
e->
to:
a-> d
b-> ad
c-> c
d-> ab
e-> b
Let's say you iterate the adjacency lists of all vertices in the graph as follows.
for each u in V:
for each v in adjacency_list[u]:
reverse_adjacency_list[v].append(u)
With this approach, you traverse the adjacency lists of all |V| vertices, which contributes O(|V|) to the overall time complexity of your algorithm. Also, as you traverse all of those adjacency list, you effectively traverse all the edges in the graph. In other words, if you concatenated all the adjacency lists you traverse, the length of that resulting list would be |E|. Thus, another O(|E|) is contributed to the overall complexity.
Consequently, the time complexity will be O(|V| + |E|) with this pretty standard approach, and you do not need to devise any peculiar method to achieve this complexity.
Given a graph G = (V, E) and a subset v of V how do you compute a "minimal spanning tree" m that connects all the nodes in v together? That is to say, it can have paths that go through vertices not in v.
My first thought was that m must be a subset of M where M is the MST of G but here is a counter-example through this diagram: Find the MST of {B, C}. It is clearly the shortest path, the edge with weight 17, which is not a subset of M.
I'm having trouble reducing this problem/defining exactly what to run a classic MST algorithm on.
Thanks in advance!
What would be the best algorithm to find localbridge(k) in Graph? A local bridge of degree k is an edge whose removal would enlarge the shortest distance between its two end-points to at least k.
Wikipedia: http://en.wikipedia.org/wiki/Bridge_(interpersonal)#Local_bridge
Run an all-shortest-path-costs algorithm, like the Floyd-Warshall algorithm, but where you use tuples (d1,d2) for distances, instead of the typical real numbers d:
d1 is the length of the shortest path
d2 is the length of the second shortest path
This modification to the Floyd-Warshall algorithm should be straightforward.
When you are done running the all-shortest-path-costs algorithm, the localbridge(k) edges are those edges e = {u, v} such that the distance (1,d2) between u and v satisfies d2 >= k.