i have a math problem that needs to be encoded in perl but i am having trouble figuring out the algorithm
Problem:
let N be a set of vertices (for our purposes let N={1,2,3,4} where numbers are vertex id's) Given any two vertices from N, label the edges so that no two adjacent edges are labelled the same and the number of labels does not exceed |N|-1.
Example:
What would be an algorithm to efficiently identify and label these edges so that the end result is a table of pairs of vertices associated to edge labels:Given a set of the above nodes: 1 2 3 4 The solution would be : b +-----------------+ | c | | +-----------+ + a | b a | 1-----2-----3-----4 | c | +-----------+ where a,b,c are edge labels and |{a,b,c}| = 3 = |N|-1
This is quite trivial if a set of nodes is small but if i scale up the number i quickly lose myself.1-2 => a 2-3 => b ...
Anyone encountered this problem before with an optimal solution?
PS: In real case scenario the number of nodes is close to 50
In reply to Graph labeling problem by baxy77bax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |