Vertex Biconnected and Edge Biconnected misconception [closed] - algorithm

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
A connected graph is vertex biconnected if there is no vertex whose removal disconnects the graph. A connected graph is edge biconnected if there is no edge whose removal disconnects the graph.
Give a proof or counterexample for each for the following statements:
(a) A vertex biconnected graph is edge biconnected.
(b) An edge biconnected graph is vertex biconnected.
For A)My attempt is that it should be the case, since I don't see how removing a vertex will affect the biconnection of the edge.
For B)My attempt is NO, since if we have a bridge, connecting two graphs, removing that edge will no longer have the graph vertex biconnected.
Perhaps I am totally wrong here, any assistance would be greatly appreciated.

Proof for a): by contradiction. Let G = (V,E) be vertex biconnected. Assume it is not edge biconnected. Then there exists an edge e = {v,w} we can remove such that G' = (V, E \ {e}) is disconnected. But then we can also remove v or w from G and disconnect the graph (since the removal of either end vertex of an edge will also remove that edge), which is a contradiction to G being vertex biconnected; thus G must also be edge biconnected.

Related

How can it be solved using Dijkstra’s algorithm? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Suppose you are given a graph where each edge represents the path cost and each vertex has also a cost which represents that, if you select a path using this node, the cost will be added with the path cost. How can it be solved using Dijkstra’s algorithm?
First solution: duplicate the nodes to add an "internal" edge
Replace the non-oriented edges with oriented edges, and duplicate every node N into one "incoming" node Ni and one "outgoing" node No so that going through a node N in the original graph is equivalent to going through both nodes Ni and No in the new graph, and thus through the extra edge from Ni to No.
A B Ao Ai
\ / \ /
N -----------> Bo - Ni - No - Bi in the new graph, every edge is oriented
| / \ all the edges on this drawing are oriented left-to-right
C Co Ci
Make sure edges between non-twin nodes are always oriented out-->in, and edges between twin nodes are always oriented in-->out. For instance there is an edge from Ni to No (twin nodes), and an edge from Bo to Ni (non twin nodes).
Second solution: add one half of the code of the node to all its edges
Add the cost of the source node to the cost of every one of its edges;
Add the cost of the target node to the cost of every one of its edges;
Add half of the cost of every other node to the cost of its edges.
Now you can check than in any path S-A-B-C-T, the costs of S and T are added once edge, and the half-costs of A, B and C are added twice.
The cost that Dijkstra's algorithm assigns to each vertex is the cost to reach that vertex. You just need to incorporate the vertex costs into that cost calculation.
If only edges have costs, then the cost to reach a vertex is the cost to reach the previous vertex plus the edge cost.
If the vertices also have costs, then the cost to reach a vertex is the cost to reach previous vertex, plus the cost of the edge and the new vertex.
Otherwise, it's exactly the same algorithm.

prove connected graph with degree = 2 has hamiltonian cycle [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
excuse me if my question is repeated but i couldn't find a complete answer to prove that a connected graph which all vertices has degree = 2 is a hamiltonian graph.
I have read this and this
Let the given graph be G. Starting from a vertex v in the graph, let us trace an arbitrary walk(path with repeated vertices allowed), P, by repeatedly picking a vertex adjacent to the last vertex added to P, without repeated any edges. Terminate if you cannot add any more vertices or if you reach a vertex that was already visited before. This process will eventually terminate since there are finitely many vertices. Note that since every vertex has degree two, the termination will be caused by a vertex repeating. Let this termination vertex be t. What we have found is really a cycle containing t. Let this subgraph consisting of just this cycle containing t be C. Let V(C) be the set of all vertices of C. Since all the vertices have degree 2 in G and C, every edge in G involving any of the vertices in V(C) is already in C. Now, let us suppose there is a vertex of G, say u, not present in V(C). There will be no path from u to any vertex of V(C), because if there was one, you would end up with an edge going from V(C) to a vertex outside, which as we just saw isn't possible. But you know that G is connected, implying that there is no such vertex u. Thus, G = C and hence G is just a cycle. Trivially, it is Hamiltonian.

Connected vs Strongly cnonected Directed Graph [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Give a graph:
Input:
0 -> 1
2 -> 1
3 -> 1
Representation:
0 -> 1 <- 2
^
|
3
This graph is not strongly connected because not every vertex u can reach vertex v and vice versa (path u to v and v to u)
The algorithm I am currently using for checking if the directed graph is strongly connected is applying DFS from each vertex O(n3), if I can find N-1 vertices from the N vertices, then the digraph is strongly connected.
Alternative algorithm is Tarjan's algorithgm.
But is this graph considered connected (not strongly) ?
If yes, what would be a good algorithm to apply.
Thank you
If you want to figure out your digraph is strongly connected there are several algorithm for that and in wiki you can find this three:
Kosaraju's algorithm
Tarjan's algorithm
Path-based strong component algorithm
If you want to check if your digraph is just connected or not, you can simply assume that it is a graph not a digraph then apply connected component algorithm with O(|V|+|E|). if it just have one connected component then your graph is connected.
The term "Connected (not strongly connected" is usually made out for undirected graphs. In your case the directed graph is not connected (strongly).
One of the algorithms that can evaluate if a digraph (directed graph) is strongly connected in O (V + E) time is named after Kosaraju who discovered it.
The wiki: http://en.wikipedia.org/wiki/Kosaraju%27s_algorithm is pretty instructive. I have implemented the algorithm and it is available here. Runs in O (v + E ). We are assuming that the graph is backed as an adjacency list.
Link for Kosaraju Implementation in Java
Try it out, hopefully you would find no bugs :-)

Finding all vertices on negative cycles [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I know that the problem of checking whether given edge of a weighted digraph belongs to a negative cycle is NP-complete (Finding the minimal subgraph that contains all negative cycles) and Bellman-Ford allows to check a vertex for the same thing in O(|V|*|E|) time. But what if I want to find all vertices belonging to negative cycles? I wonder if it could be done faster than Floyd-Warshall's O(|V|^3).
I don't think Floyd-Warshall does the job of finding these vertices. Using a similar approach as taken in the post you're referring to, it can be shown that finding the set of all vertices that lie on a negative cycle is NP-complete as well.
The related post shows that one may use the algorithm to find the set of all edges that lie on a negative cycle to solve the hamiltonian cycle problem, which means that the former problem is NP-complete.
If we can reduce the problem of finding all edges that lie on a negative cycle to the problem of finding the set of all vertices that lie on a negative cycle, we've shown NP-completeness of the latter problem.
For each edge (u,w) in your weighted digraph, introduce a new auxiliary vertex v, and split (u, w) in two edges (u, v) and (v, w). The weight of (u, w) can be assigned to either (u, v) or (v, w).
Now apply the magic polynomial-time algorithm to find all the vertices that lie on a negative cycle, and take the subset that consists of the auxiliary vertices. Since each auxiliary vertex is associated with an edge, we've solved the problem of finding the minimal subgraph that contains all negative cycles, and we can thus also solve the hamiltonian cycle problem in polynomial time, which implies P = NP. Assuming P != NP, finding all vertices that lie on a negative cycle is NP-complete.

Using DFS on a Graph - Determine if a graph is a clique with specific SCC [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a simple question on DFS and I'm trying to understand how to use it and not how to solve the whole problem. I'm really looking for an explanation and not a solution to my homework.
I'll write down the question first.
"Suppose you have an undirected graph G=(V,E) and let three of its
vertices to be called v1, v2 and v3. Find an algorithm which
determines if these three vertices are part of a clique
(complete graph) (k>=3)"
Now I suppose to use DFS in order to solve it. As far as I understand DFS will let me know if v1, v2 and v3 are in the same strongly connected component. If I'm correct I should also determine if G is also a clique(complete graph).
I read in the internet and I found out that asserting if a graph is clique or not is NP and cannot be solved easily. Am I correct? Am I missing anything? Is there any propery I can use to determine immediately if a graph is comeplete ?
To clarify the confusion about the NP-completeness: checking whether a graph is a clique is not NP-complete; just count the edges and see whether there are n(n-1)/2. What is NP-complete is to find a maximum clique (meaning the subgraph that has the biggest number of vertices and is a clique) or a clique of k vertices in a graph of n vertices (if k is part of the input instead of a fixed number); the latter case is called the clique decision problem.
EDIT: I just realized you asked something regarding strongly connected components as well; that term only applies to directed graphs (i.e. the edges have a direction, which means for two vertices v and w, the edge v->w is not the same as the edge w->v). Cliques are commonly defined on undirected graphs, for which there are only connected components.
If I understood it properly, all you have to check whether these three vertices are connected, i.e., the edges v1-v2, v2-v3 and v3-v1 exists. If they exist, they form a clique of K=3. If at least one of them does not, these three vertices together can not be in a clique of size k>=3.

Resources