This is an optimization / minimum flow problem. For this directed graph, I would like all vertices to be visited exactly once, but this graph can exist multiple disjoint paths, and each path has constraints on its total cost. The goal of this problem is to minimize the total cost of all disjoint paths.
I only know how to find Dijkstra shortest path, and I am not sure if similar principle can be applied. Please help me out and share your thoughts on this.
Thank you so much!
It sounds to me you are describing a vehicle routing problem, where each route is constrained e.g. by the vehicle capacity or maximum travel time. Have a look at https://en.wikipedia.org/wiki/Vehicle_routing_problem.
Related
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.
I have a directed graph with less than 600 nodes, and each node's edge number is less than 8.
Now I need to find a path in this graph which must pass through some given nodes(<50). The order of passing given nodes is free.
I know it's a NPC problem, but I don't know how to solve it.
An approximate solution is also acceptable.
Thank you!
Compute the shortest ways between all pairs of the specific nodes. Then create a new graph that only contains those nodes, with the length of the shortest paths as distances. Now, the problem is "reduced" to Travelling Salesman.
(TSM has a fast 3/2-approximation that utilitizes minimal spanning trees and a matching, if that is good enough - the 50! possibilities are too much in any case)
While working on a project I've stumbled upon a graph algorithms problem I
haven't been able to solve. The problem is as follows:
You have a directed, weighted graph and want to find the shortest path between a
start node and an end node while visiting specified nodes (very much like
Find the shortest path in a graph which visits certain nodes).
However, along with nodes and edges, this graph also has the notion of "items",
which reside at nodes and you "pick up" when you enter that node. Now there is an extra constraint that edges can only be
traversed if you have obtained the necessary items, I, for that particular edge.
Think of it as a key for a door; you need to obtain a key before being able to
pass through the door.
I can only think of brute-force methods that blow up exponentially. Can anyone think of anything better or point me to a place where this problem is solved? Or maybe convince me that this is "hard" (computationally speaking)? Thanks for any help!
This problem is NP-HARD to solve optimally. There's a simple reduction from the Hamiltonian path problem:
Put unique items on each vertex of the original graph. Construct an sink vertex connected only to the destination vertex. Let the edge between these two vertices require all of the items.
You can try a modified version of the saving algorithm. It's a heuristic to solve the vehicle routing problem. Maybe you can reverse it and create a pick up function for the wanted keys. It's use for a delivery and shortest path problem.
i´m obviously missing the forest through the trees ...
i know about the traveling salesman problem, but is there any other algorithm/problem which better fits my needs/description? I need to describe my problem with the help of such a mathematical description.
I have up to five points with known start- and endpoint. So i just need to calculate the shortest way to visit all the three points between that two. Dijkstra and similar algorithms try to find the shortest path between two points, so here they probably won´t visit all points between. Or is there a algorithm which finds shortest way and visit all points between two points?
You are overthinking it. There are only six (3*2*1) possible paths through the three intermediate nodes. Just check them all.
For larger instances, you could reduce your problem to the TSP as follows:
If s is the starting node and t is the final node, add a zero-weight edge between s and t and an infinitely-heavy edge between s and every other node, and between t and every other node.
The problem is NP-hard, but is extremely well-researched. There is a plethora of exact and approximate algorithms that you could explore.
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.