I have reduced my problem to finding the minimal spanning tree in the graph. But I want to have one more constraint which is that the total degree for each vertex shouldnt exceed a certain constant factor. How do I model my problem? Is MST the wrong path? Do you know any algorithms that will help me?
One more problem: My graph has duplicate edge weights so is there a way to count the number of unique MSTs? Are there algorithms that do this?
Thank You.
Edit: By degree, I mean the total number of edges connecting the vertex. By duplicate edge weight I mean that two edges have the same weight.
Well, it's easy to prove that there may not be a solution: just make your input graph a tree that has a vertex with degree higher than your limit..
Garey Johnson had this problem reduce to hamilton :( So this one helped. Approximating the first one: http://caislab.icu.ac.kr/Lecture/data/2003/spring/ice514/project/m03.ppt
However, better working models are appreciated...
Counting: http://mathworld.wolfram.com/SpanningTree.html . According to this, mathematica has a function. Any suggestions in this one?
This paper shows how to find, in polynomial time, a spanning tree of maximum degree d + 1 that is at least as good as any spanning tree of maximum degree d: http://www.andrew.cmu.edu/user/mohits/mbdst.pdf
//Edit The original link is currently inactive, try http://research.microsoft.com/pubs/80193/mbdst.pdf instead.
Related
Assume we're given a graph on a 2D-plane with n nodes and edge between each pair of nodes, having a weight equal to a euclidean distance. The initial problem is to find MST of this graph and it's quite clear how to solve that using Prim's or Kruskal's algorithm.
Now let's say we have k extra nodes, which we can place in any integer point on our 2D-plane. The problem is to find locations for these nodes so as new graph has the smallest possible MST, if it is not necessary to use all of these extra nodes.
It is obviously impossible to find the exact solution (in poly-time), but the goal is to find the best approximate one (which can be found within 1 sec). Maybe you can come up with some hints of the most efficient way of going throw possible solutions, or provide with some articles, where the similar problem is covered.
It is very interesting problem which you are working on. You have many options to attack this problem. The best known heuristics in such situation are - Genetic Algorithms, Particle Swarm Optimization, Differential Evolution and many others of this kind.
What is nice for such kind of heuristics is that you can limit their execution to a certain amount of time (let say 1 second). If it was my task to do I would try first Genetic Algorithms.
You could try with a greedy algorithm, try the longest edges in the MST, potentially these could give the largest savings.
Select the longest edge, now get the potential edge from each vertex that are closed in angle to the chosen one, from each side.
from these select the best Steiner point.
Fix the MST ...
repeat until 1 sec is gone.
The challenge is what to do if one of the vertexes is itself a Steiner point.
I have an edge weighted connected graph. It is not a directed one. My task is to remove a few edges so that the graph become divided into at least two half and the sum of weights of the removed edges has to be the least possible.
I know how to find the minimum path between any vertices, I think it has to help somehow, but still I cannot come up with any good idea. If anyone knows advise me plese the algorithm of solving the problem.
Does anyone have any idea about how to find all paths from a source vertex to a target vertex under a specific weight in a graph?
PS, the graph is huge in my case (around million vertices), but a general efficient algorithm would also be appreciated.
Please don't say to run Yen's algorithm with some search for the "correct" k.
Thanks.
There is an answer on mathoverflow for finding all paths in an undirected graph. You can modify this answer to include weight consideration. As he stated in his answer
The idea is very simple: Do an exhaustive search, but bail early if you've gotten yourself into a corner.
In addition to that, you will have to bail when the weight is off the limit.
is there an algorithm for finding all the independent sets of an directed graph ?
From what i've read an independent set represents a set formed by the nodes that are not adjacent.
So for this example I would have {1} {2} {1,3}
So how is possible to find all of them, I am thinking about something recursive but I don't really know the algorithm, if someone could point me in the right direction it would be much appreciated !
Thank you!
Typical way to find independent sets is to consider the complement of a graph. A complement of a graph is defined as a graph with the same set of vertices and an edge between a pair if and only if there is no edge between them in the original graph. An independent set in the graph corresponds to a clique in the complements. Finding all the cliques is exponential in complexity so you can not improve brute force much. Still I believe considering the complement of the graph may make the problem easier to deal with.
Other than complement and finding cliques, I can also think about "Graph Coloring", you color the vertices somehow that no two adjacent vertices have the same color (you can do it with a very simple heuristic algorithm like SL = Smallest Last), and then choose vertices in every color as a subset (as a maximal independent subset).
The only problem is that there are probably too many ways of coloring a graph. You have to keep all the found (maximal) independent sets and move on until you get enough sets!
The Bron–Kerbosch algorithm is commonly used for this problem, see the Wikipedia article for a description and pseudocode that can be turned into a useable program without too much problem. The size of output is, in the worst case, exponential in the number of vertices, but brute force will always be exponential while BK will be polynomial if the output is polynomial. In other words if you know that the output will be reasonable then BK will produce it in a reasonable time. This is an active area of research and there are a number of other algorithms that do the same thing with varying efficiency depending of the type and size of graph. There are applications in several areas, in particular genetics.
I'm going through an algorithms textbook to improve my algorithm skills but I'm completely stuck on this question and it's bugging me. I think the underlying data structure is a graph but I don't even know where to begin with this problem. Can anyone give some insight? Thanks
You are given a topographical map that provides the maximum altitude
along the direct road between any two neighboring cities, and two
cities a and b. Come up with an a linear time algorithm that finds a
route from s to t that minimizes the maximum altitude. Roads can be
traversed in both directions.
This is a tricky question. I would assume that there are some hints in the chapter that are supposed to guide you towards the solution.
The problem you are describing is an instance of the minimax path problem, or widest path problem.
http://en.wikipedia.org/wiki/Widest_path_problem
According to wikipedia, there is a linear time algorithm, but it is pretty complicated, so I doubt the book expects you to figure that out. The simpler way to solve this problem is to find a minimum spanning tree. Due to the "min cut" property of a minimum spanning tree, the path connecting a and b along a minimum spanning tree will have the minimax property, meaning that the maximum altitude along this path will be the minimum of any path connecting a to b.
However, there is no linear time minimum spanning tree algorithm. On the other hand, if we can assume that the graph is planar -- which we probably can since it is a road map -- then it is possible to find a minimum spanning tree in linear time. So I think this is what they might be after. Does the chapter containing this problem talk about minimum spanning trees and/or planar graphs?