Questions tagged [spanning-tree]

A spanning tree in an connected, undirected graph is a subgraph that includes all vertices, is a tree and is connected.

106 questions
3
votes
2 answers

Create Spanning Tree With DFS

Running the Depth First Search (DFS) algorithm over a given graph G = (V,E) which is connected and undirected provides a spanning tree. While running DFS on the graph, when we arrive to a vertex which it's degree is greater than 1 , i.e - there is…
user975343
2
votes
2 answers

Random spanning trees of bipartite graphs

I'm working on making some code using metaheuristics for finding good solutions to the Fixed Charge Transportation Problem (FCTP). The problem I'm having is to generate a starting solution, based on finding a spanning tree for the underlying…
Undreren
  • 2,811
  • 1
  • 22
  • 34
2
votes
1 answer

Spanning tree that minimizes a dynamic 'metric'

Let us have a graph. When we remove an edge, 2 'cars' are created, one from each vertice of the edge. when these 2 cars meet they stop. The problem is to create a spanning tree so that the sum of the numbers of cars that pass through each vertice is…
2
votes
2 answers

Find all spanning trees of a directed weighted graph

I have found this paper so far. Is it outdated? Are there any faster and better implementations? By the way, Wikipedia says that there can be n^n-2 spanning trees in a undirected graph. How many spanning trees can be in a directed graph?
skanatek
  • 5,133
  • 3
  • 47
  • 75
2
votes
1 answer

Difference between prims and boruvka's Algorithm

I am studying about MST algorithms. I am curious to find the key differences between prims and boruvka's algorithm but the resources online don't have much to say about them other than their implementation and algorithm. If someone can explain, it…
2
votes
3 answers

Write an algorithm in Python which takes a prufer code as input and returns the edge set of the tree

Write an algorithm in Python which takes a prufer code as input and returns the edge set of the tree. Input: a list named "p" (the prufer code, zero-indexed) Example: p = [3,1,0,0,3,2,9,9,2,3] (The prufer code can be defined within the code block.…
Lalo G
  • 37
  • 4
2
votes
1 answer

Construct an efficient, minimum spanning tree such that given subset of vertices in G are leaves + proof

I am trying to design an algorithm where, given a connected weighted graph G = (V, E) and a subset of vertices U that is in V, will construct a minimum spanning tree such that all vertices in U are leaves (other vertices may also be leaves), or…
2
votes
1 answer

Is there an efficient way to find the sizes of components in a spanning tree graph after removing an edge?

My task is to efficiently process Q queries in a spanning tree graph with N nodes. Each query refers to an edge that I am required to process, and I am supposed to output the sizes of each of the two components in the graph that remain after…
2
votes
2 answers

converting a unbalanced tree to a spanning tree

How to convert an unbalanced tree into a (balanced) spanning tree? Suppose I have a tree (with different (not necessarily distinct) number of children at different nodes). I want to manipulate the tree in such a way that it becomes a k-ary spanning…
Akhil
  • 2,269
  • 6
  • 32
  • 39
2
votes
1 answer

Spanning tree on grid with minimum number of turns

Is there a polynomial algorithm to find a spanning tree of an undirected grid graph which minimizes the number of turns in tree? A turn is when there are two edges connected to one vertex which have perpendicular directions. In this problem we have…
2
votes
1 answer

Find a spanning tree with maximum number of edges with same weight

Here's the problem. A weighted undirected connected graph G is given. The weights are constant. The task is to come up with an algorithm that would find the total weight of a spanning tree for G that fulfills these two conditions (ordered by…
2
votes
2 answers

How to form a cluster and choose cluster header on this environment?

I'm new to the whole distributed system world. I need help to how to form a cluster on this environment and also decide which one is the CH(cluster header). I want use spanning tree to choose the nodes with highest energy to be the CH. When CH is…
TrieuBui
  • 51
  • 1
  • 5
2
votes
1 answer

Can a spanning tree contain a self loop?

I am referring to explanation of spanning tree given here. I want to know can a spanning tree contain self loop? I.e. edge from one vertex to itself? I guess, no; because then for that loop there are two paths to reach that node. one direct and one…
Kaushik Lele
  • 6,439
  • 13
  • 50
  • 76
2
votes
2 answers

Java Network/Tree simulations goes to infinite loop after certain amount of Nodes

I hope someone can help with the issue I am having. First of all, I tried to remove as much code as I can that wasn't causing the issue. My problem is this: When I run the program everything runs perfectly until I create a graph with about 130…
Kevin Zaki
  • 146
  • 1
  • 2
  • 9
2
votes
1 answer

How to check a Minimum spanning tree

How can I check in linear time O(n) if the given tree is a MST?
user1016401
  • 65
  • 1
  • 6