About Minimum Spanning Tree Graph - algorithm

Is there an algorithm better (More optimal,faster) than Prime and Kruskal's algorithms ?

Prime's algorithm and Kruskal's algorithms works really fast if it is implemented well. Try to use optimal data structures for your data set case.
In really you don't need in more faster algorithm in most cases.
If you need in parallel implementation of algorithm, than use Borůvka's algorithm.
If you need the theory-fastest algorithm, than check Decision trees algorithm.
And there is special case with linear algorithm.

Related

Why greedy algorithm is heuristic, not meta-heuristic?

AFAIK, heuristic algorithm is problem-dependent and meta-heuristic are problem-independent, according to this answer.1
But greedy algorithm can apply to many problems, such as minimum spanning tree and shortest path problem. My question is that why is it problem-dependent, not problem-independent?
There are a lot of greedy algorithms for different problems, greedy algorithm is not the one particular algorithm, it's a class of algorithms that use the same approach to the problem. Dijkstra's algorithm, Prim's algorithm, Kruskal's algorithm, etc. are completely different, but they are all greedy.
In Dijkstra's algorithm you take an untouched node with minimal distance to it.
In Prim's algorithm you take an edge, that connects tree node with not-tree node, with minimal weight.
In Kruskal's algorithm you take an edge, that connects two different trees, with minimal weight.
And there are many greedy algorithms that don't even work with graphs.
All these heuristics are different and problem-specific, because these algorithms solve completely different problems.

Which is the best algorithm to use out of dincis algorithm and ford fulkerson to solve max flow problems?

Out of these algorithms which will be the best efficient algorithm to solve max flow problems
Which is the best algorithm to use to solve max flow problems?
Answer is: it depends...
Without any information about the graph you have:
Ford–Fulkerson algorithm O(f*E)
Edmonds–Karp algorithm O(V*E^2)
Dinic's algorithm O(V^2*E) but very fast in practice
You must choose which one to use depending on the memory and time constraints of the problem.
V: the number of vertex in the graph
E: the number of edges in the graph
f: is the maximum flow in the graph
Bipartite Graph
Also, if it is a bipartite graph your implementation can be O(n*m)
n: the cardinality of set A
m: the cardinality of set B
Competitive Programming:
In competitive programming Dinic's algorithm is one of the most useful because is very fast in practice. Many of the problems I solved were using Dinic. Although if the restrictions of the problem are not strong implement Ford–Fulkerson algorithm or Edmonds–Karp algorithm is faster than Dinic's algorithm (the time of coding is important too)

Linear time algorithm for finding value of MST in a graph?

Is there a linear О(n+m) time algorithm for finding just the value r of the minimum spanning tree of a given graph G(V,E)? We do not want to find that MST, just the sum of its edges.
I have searched for solution of the problem, but Kruskal's and Prim's algorithms are with higher complexity because of the comparison structures they use(UnionFind(Kruskal) and PQ(Prim)). Also they find the MST, which is not desired and maybe there is faster way to find only r.
If your edges are integer weighted, there is a linear algorithm from Ferdman and Willard in the following publication:
http://www.sciencedirect.com/science/article/pii/S0022000005800649
There is also a randomize linear time algorithm from Karger, Klein and Tarjan using a comparaison model:
http://dl.acm.org/citation.cfm?doid=201019.201022
I belive that in the comparaison model Chazelle's algorithm using soft heap is the fastest deterministic one, but it's not a linear one (you have a inverse Akermann overhead).
No. There's no linear solution.
You can optimize Kruskal with disjoin-set optimizations and radix/counting sort so that the complexity is O(E alpha(V)) where alpha is a very slow growing inverse Akermann function. For most datasets this will be almost indistinguishable from linear. At this point you can probably gain more at run-time by optimizing the code rather than the algorithm.

Best parallel algorithm for detecting cycles in a undirect graph

I want to detect cycles in an undirected graph such that I can find the minimum spanning tree (in particular I want to use Kruskal algorithm). Since I want to parallelize the code, I was wondering which algorithm is the best, Depth-first search of union-find algorithm?
Thanks for any suggestions.
Of all three MST algorithms only Boruvka's MST algorithm is easily parallelizable whereas the kruskal and prims are sequential greedy algorithms hence there is minimum scope for parallel implementation of them.
Note: It is a research topic to achieve efficient parallel boruvka might find some papers

Why does A* run faster than Dijkstra's algorithm?

Wikipedia says A* runs in O(|E|) where |E| is the number of edges in the graph. But my friend says A* is just a general case of Dijkstra's algorithm, and Dijkstra's algorithm runs in O(|E| + |V| log |V|). So I am confused about why A* runs faster than Dijkstra's algorithm.
I think the time complexity of A* listed on Wikipedia is incorrect (or at least, it's misleading). That time complexity only seems to count the number of states expanded in the search, rather than the time required to determine which states to explore.
To be efficient, A* search needs to store a priority queue containing what nodes in the fringe need to be explored and it has to be able to call decrease-key on those priorities. The runtime for this is, in the worst-case, O(n log n + m) if implemented using a good priority queue. Therefore, in the worst case, you'd expect A* to degrade to Dijkstra's algorithm. Given a good heuristic, A* will not expand out all the nodes and edges that Dijkstra's algorithm would, which is the main reason why A* is faster.
Of course, the time complexity of A* search needs to factor in the cost of computing the heuristic. Some complex heuristics might not be computable in time O(1), in which case the runtime for A* could actually be worse than Dijkstra's algorithm.
Hope this helps!
Essentially A* is faster because it can use heuristics to make more educated guesses about which route is the best to case, something which Dijkstra's algorithm does not do.

Resources