608 questions
1
vote
1
answer
112
views
Postgres Recursive Query Behavior
I have a table test with two columns, each referencing the other
ID1
ID2
2
1
3
2
4
3
5
4
Given an id, I need to traverse the chain to return all the rows traversing the chain. Below is the query I ...
-2
votes
1
answer
138
views
Constrained MST: Find a spanning tree of weight ≤ T that minimizes the number of red edges
We are given an undirected graph ( G = (V, E) ), where:
( V ) is the set of vertices (or nodes),
( E ) is the set of edges.
Each edge ( e ∈ E ) has two attributes:
A weight ( w(e) ), which is a ...
4
votes
4
answers
415
views
Fast way of detecting outliers in 2D space
I have hundreds of millions of point clouds like the following:
I want to remove outliers 1, 2, 4, 5, 6, 7. The safest bet is to build a minimum spanning tree connecting all the points and remove ...
0
votes
1
answer
71
views
What is the complexity of the following code? Is it O(n^3log(n))?
What is the complexity of the following code? Is it O(n^3log(n))?
#G is an undirected dense graph, which has N vertices.
import networkx as nx
def cal_minimax_path_matrix(G):
MST = nx....
2
votes
0
answers
237
views
Fastest way to run Steiner tree on large graph?
I have a very large graph (25GB, 35 million edges) and a collection of nodes. I want to find a tree that has all of those nodes; a tree that minimizes the number of edges but maximizes the number of ...
0
votes
0
answers
202
views
Manhattan Distance Minimum Spanning Tree
I'm working on a Steiner Tree algorithm for rectilinear graphs (Manhattan distance) and first of all I need to compute a minimum spanning tree as an upper bound, also with Manhattan distance. This is ...
0
votes
1
answer
79
views
Proof in Minimum Spanning Trees(More of a mathematical problem)
As we know minimum spanning tree tries to achieve the "minimum" sum of weights of the tree.
Now my questions.
Using prim and kruskal algorithms,
1) If we change what we are trying to ...
0
votes
1
answer
259
views
How to annotate distances of distance matrix to edges of a minimum-spanning-tree in R?
Aloha guys!
I am trying to create a Minimum-Spanning-Tree with ggplot, because I want to make use of the ggplot2 and especially ggnetwork functions like geom_edgelabel() to receive a sophisticated, ...
0
votes
0
answers
256
views
generate all mst's with igraph in r
Given that for a graph the Minimum Spanning Tree might not be unique I want to generate all distinct MSTs with igraph in R. Is that possible?
For now, I'm obtaining a single MST:
completeGraph <- ...
1
vote
0
answers
56
views
In Kruskal's Algorithm, why does the union procedure check whether r_x == r_y since the opposite was required to call union()?
In Algorithms [DPV] Section 5.1.3, the authors outlined Kruskal's Algorithm. In the algorithm itself, while iterating through all edges on the graph, they compare whether find(u) != find(v). If so, ...
-1
votes
1
answer
109
views
minimum time to travel between stations
I have implemented a Java program that aims to find the minimum time required to reach each station based on the given bus schedules using Breadth-First Search (BFS). However, the program consistently ...
-1
votes
2
answers
343
views
Fastest Algorithm/Software for MST and Searching on Large Sparse Graphs
I've developed a graph clustering model for assigning destinations to vehicle routes, but my implementation is very slow. It takes about two days to process a graph with 400k nodes.
My current ...
6
votes
1
answer
254
views
MST that crosses a graph cut exactly N times
Given two connected weighted graphs and a set of pairs of vertices that can "cross the river" between the two graphs, the task is to find an MST (minimum spanning tree) of a graph made of ...
-2
votes
2
answers
1k
views
What is a minimal-spanning subnet?
What is a minimal-spanning subnet? How do you find it for a given set of IPv4 addresses?
I know the minimum spanning tree but what is the minimum spanning subnet? and how to find it by the given ipv4 ...
0
votes
1
answer
525
views
Proving the following claim for MST (Minimum Spanning Trees)?
I want to prove the following claim for undirected and connected graph, Spanning Tree (T) and weight function with real numbers:
$T$ is a minimum spanning tree in $G=(V,E)$ iff for every edge
$e=u-v$ ...
2
votes
0
answers
145
views
Please provide a valid WRITE query
I try to run minimum spanning tree algorithm inside Spark using Neo4j Connector. But when I try to call it I get an error: Please provide a valid WRITE query.
My code looks like this:
val df = (1 to ...
0
votes
1
answer
63
views
What is the logic behind this index in Kruskal's minimum spanning tree algorithm?
I don't understand why we are increasing e += 1 when the parents are not same. And why the while loop stops based on e's value? Why we need that index?
def kruskal(self):
i, e = 0, 0
ds = dst....
1
vote
1
answer
647
views
C# Prim's algorithm isn't generating maze correctly
I was trying to implement a C# version of the Java code given in this answer to generate a random maze, but my code doesn't quite generate the mazes correctly - it creates "isolated" wall ...
0
votes
1
answer
1k
views
Prim's algorithm using heap or unsorted array?
There's a question in my CS class asking that if the graph is a sparse graph, which is n^2 >> m, whether unsorted list with O(n^2) is more efficient than the binary heap O((m+n)logn). I'm a ...
0
votes
1
answer
213
views
True or False: For an undirected graph, for every vertex, its edge with minimum weight is in a minimum spanning tree
I think this is true. With consideration to Prim's algorithm, the minimum edge of a vertex is either already in a tree, or will be selected eventually.
I also tried a lot of graph and they all seem ...
1
vote
1
answer
383
views
How can I find an MST from all trees containing a given edge?
In a weighted undirected graph, I need to modify Kruskal's algorithm to find the MST conditional to the fact that it includes a given edge 'e' in O(m log n) time. How can I do that?
0
votes
1
answer
119
views
Getting nodes without edges (When the N is larger than 60)
First I generated an NxN matrix of zeros and ones using NumPy. After that, I generated a copy matrix from the previous matrix, I replaced the ones in the first matrix with the weight of the edges. ( ...
0
votes
2
answers
198
views
How is a cut lonely if there are often multiple edges crossing a cut in a connected undirected graph?
I'm learning the requirements for finding a minimum spanning tree for a connected, undirected graph with distinct edge costs. One of the requirements is that there must be no cycles created in the ...
-1
votes
1
answer
118
views
Coding MST (4) in CPLEX
I'm trying to code MST4 in CPLEX, but because I'm new to code writing I have difficulty in doing it. I would really appreciate if anyone could help me.
Thanks
0
votes
0
answers
341
views
making kruskal's algorithm in c (segmentation fault)
In this code I want to make Kruskal's algorithm, which calculates a minimum
spanning tree of a given graph. And I want to use min-heap and disjoint set at the code.
To make time complexity of O(e log ...