spanning-tree

Configure STP protocol via scapy

夙愿已清 提交于 2021-02-11 13:42:00
问题 I need to generate and STP traffic using scapy and when I visualize it via wireshark I get an output similar to the caption shown below: when I run this code: from scapy.all import STP import scapy from scapy.all import * data='STP' sendp(Ether(dst="01:80:c2:00:00:00")/LLC(dsap=0xaa, ssap=0xaa)/STP(bpdutype=0x00, bpduflags=0x01, portid=0x8002)/data, iface="eth1", count=200) this is my wireshark output I don't know how to change the organization code to 00:00:0c, because I believe it's the one

spanning tree with exactly k colored edges

五迷三道 提交于 2019-12-30 10:35:32
问题 I have a connected, undirected graph with edges that are each either black or white, and an integer k. I'm trying to write an algorithm that tells whether or not a spanning tree exists with exactly k black edges (doesn't necessarily have to find the actual tree). I used Kruskal's algorithm to find the minimum and maximum possible number of black edges in a spanning tree. If k is outside this range, no spanning tree with k edges can exist. But I'm having trouble wrapping my mind around whether

How to indicate preorder of a spanning tree using the algorithm BFS

懵懂的女人 提交于 2019-12-25 09:01:12
问题 I'm doing an implementation of the BFS algorithm in c++ to find a spanning tree, the output for a spanning tree should be shown in preorder, but I have a doubt in the implementation, how I can build a tree if not exactly know how many children have each node?. Considering a tree structure recursive The data structure of the tree can be written as: typedef struct node { int val; struct node *left, *right; }*tree; //tree has been typedefed as a node pointer. But do not think it works this

Create Spanning Tree With DFS

天涯浪子 提交于 2019-12-12 17:05:21
问题 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 more than one edge connected to it , we randomly choose an edge to continue with. I'd like to know if the option to choose an edge (or a vertex) to continue with actually allows as to create every spanning tree of a given graph using DFS? 回答1: Since

How to write a recursive function in Python?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 17:59:23
问题 I have an undirected graph, and I want to iteratively remove each serial edge and replace it with a new edge. The weight of the new edge represents the number of spanning trees, and should be computed as follows: T_new = (1/a+b) * T_old , where a and b are the weights of the removed edges, T_new is the number of spanning trees in current iteration and T_old is the number of spanning trees in the previous iteration. This equation changes iteratively, as the graph changes, so if we have 4

Find all spanning trees of a directed weighted graph

家住魔仙堡 提交于 2019-12-11 14:13:57
问题 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? 回答1: If you use terms from paper you mentioned and you define spanning tree of directed graph as tree rooted in vertex r, having unique path from r to any other vertex then: It's obvious that worst case when directed graph has the greatest number of the

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

久未见 提交于 2019-12-11 02:08:53
问题 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 priority ): The spanning tree has to have maximum number of edges with the same weight (the actual repeated weight value is irrelevant); The total spanning tree weight should be minimized. That means, for example, that the spanning tree T1 with weight

How to find total number of minimum spanning trees in a graph?

為{幸葍}努か 提交于 2019-12-03 13:08:08
问题 I don't want to find all the minimum spanning trees but I want to know how many of them are there, here is the method I considered: Find one minimum spanning tree using prim's or kruskal's algorithm and then find the weights of all the spanning trees and increment the running counter when it is equal to the weight of minimum spanning tree. I couldn't find any method to find the weights of all the spanning trees and also the number of spanning trees might be very large, so this method might

How is a minimum bottleneck spanning tree different from a minimum spanning tree?

邮差的信 提交于 2019-12-03 04:14:54
问题 A minimum bottleneck spanning tree of a weighted graph G is a spanning tree of G such that minimizes the maximum weight of any edge in the spanning tree. A MBST is not necessarily a MST (minimum spanning tree). Please give an example where these statements make sense. 回答1: Look at the MST example on Wikipedia for reference: A bottleneck in a spanning tree is a maximum-weight edge in that tree. There may be several bottlenecks (all of the same weight of course) in a spanning tree. In the

How is a minimum bottleneck spanning tree different from a minimum spanning tree?

穿精又带淫゛_ 提交于 2019-12-02 16:38:04
A minimum bottleneck spanning tree of a weighted graph G is a spanning tree of G such that minimizes the maximum weight of any edge in the spanning tree. A MBST is not necessarily a MST (minimum spanning tree). Please give an example where these statements make sense. dan3 Look at the MST example on Wikipedia for reference: A bottleneck in a spanning tree is a maximum-weight edge in that tree. There may be several bottlenecks (all of the same weight of course) in a spanning tree. In the Wikipedia MST there are two bottlenecks of weight 8. Now, take a minimum spanning tree of a given graph