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
1
vote
3 answers

Spanning Tree Protocol

How to get switch MAC address while implementing spanning tree protocol?
saiprasad
1
vote
0 answers

configure spanning-tree loopguard, root guard, bpdu guard on Cisco switches

I'm learning to configure spanning-tree guard loop, guard root, bpdu guard, etc. Some best practices guide on the web and cisco site said that spanning-tree loopguard default should be configured globally for the entire switched network, other guide…
CBLT
  • 124
  • 1
  • 2
  • 10
1
vote
1 answer

Spanning Trees in Answer Set Programming

For the undirected graph described below, I am trying to get its spanning trees and then separate its leaves from the internal nodes. Could you please help me with my code ? What I expect to see after running the code is something like : Answer 1 :…
1
vote
2 answers

Finding a Spanning Tree Using other Spanning Trees of =(,)

I am having trouble coming up with a polynomial time algorithm to solve the following problem: Let =(,) be an undirected and unweighted graph with vertices. Let _1,_2,...,_ be =−1 distinct spanning trees of . Find a polynomial time algorithm that…
John
  • 13
  • 1
  • 3
1
vote
1 answer

Understanding the syntax of dictionaries used for graph construction and how to manipulate them

I have the following python dictionary representing a weighted graph graph1 = { 0: {1: 1, 2: 2}, 1: {0: 1, 2: 0, 3: 0, 4: 3}, 2: {0: 2, 1: 0, 5: 4}, 3: {1: 0, 4: 0}, 4: {1: 3, 3: 0, 5: 0}, 5: {2: 4, 4: 0, 6: 0}, 6: {5:…
1
vote
1 answer

Find all spanning trees from a given root

How can I use breath-first-search to find all the possible spanning trees from a starting vertex. Not just one.
1
vote
1 answer

How to find the MST of a Graph in |V| Time given a spanning tree plus another edge

I'm wondering how to go about solving this problem. I'm given a graph G = (V,E). This is a connected undirected weighted graph. The graph consists of a spanning tree and one additional edge. How would I come up with an algorithm that would compute…
1
vote
1 answer

Finding a Spanning Tree with a Target Cost

I'm quite stumped on this one. New to posting, so forgive me if this is a silly question. Say we are given a graph G=(V,E) with weighted edges. I would like to create spanning tree of G with a target cost of c, where a spanning tree's cost is…
tele
  • 11
  • 1
1
vote
1 answer

Cut at the end of a Prolog statement

I have encountered this cut which should return true if there exists an edge A-B or B-A for some node B of graph Graph. node(A,Graph) :- adjacent(A,_,Graph),!. The problem is I do not understand why removing this cut would have any effects on the…
Slazer
  • 4,750
  • 7
  • 33
  • 60
1
vote
2 answers

Spanning tree with shortest path between two points

I have weighted undirected graph. I need to find spanning tree with minimal possible cost, so that distance between point A and B will be as low as possible. For example, I have this graph: graph. Minimal distance between A and B is 2. Minimal…
Peter Jung
  • 23
  • 7
1
vote
2 answers

Spanning tree on python

I have this hw: Read edge list from a file Turn it into an adjacency list Output an unweighted, undirected spanning tree of the graph (we can assume starting point is at vertex 0) I have problem getting 3. to output correctly. Namely, file 1…
Kenshin
  • 53
  • 1
  • 8
1
vote
1 answer

Spanning Tree list from edge list in Python

I am trying to figure out how to print a Spanning Tree list from a given list of edges. For example, if I read in: 0 1 2 1 0 2 1 3 I want to print out a Spanning Tree list of: [[1], [0,2,3], [1], [1]] I know how to create an adjacency list using the…
1
vote
0 answers

How to print the output 8 after interning the sample input?

i know the logic behind it, but i don't know how to apply it to finish my code to output 8. The way to get 8 was to added up the shortest paths to each vertex in the graph. The shortest path is the path with the least number of vertices. If there is…
Assam Ali
  • 11
  • 2
1
vote
1 answer

Networkx: all Spanning Trees and their associated total weight

Given a simple undirected grid network like this: import networkx as nx from pylab import * import matplotlib.pyplot as plt %pylab inline ncols=3 N=3 G=nx.grid_2d_graph(N,N) labels = dict( ((i,j), i + (N-1-j) * N ) for i, j in G.nodes()…
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
1
vote
1 answer

Chu-Liu Edmond's algorithm (for directed graph)

I like to find a minimum spanning tree (or even forest) in a directed graph (which sometimes might have cycle). The one explained here has some errors. Is there any package/code for this algorithm in Python which actually works?
Erin
  • 177
  • 3
  • 14