Constant time generation of trees with specified diameter

  • Authors:
  • Shin-ichi Nakano;Takeaki Uno

  • Affiliations:
  • Gunma University, Kiryu-Shi, Japan;National Institute of Informatics, Tokyo, Japan

  • Venue:
  • WG'04 Proceedings of the 30th international conference on Graph-Theoretic Concepts in Computer Science
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

Many algorithms to generate all trees with n vertices without repetition are already known. The best algorithm runs in time proportional to the number of trees. However, the time needed to generate each tree may not be bounded by a constant, even though it is “on average”. In this paper we give a simple algorithm to generate all trees with exactly n vertices and diameter d, without repetition. Our algorithm generates each tree in constant time. It also generates all trees so that each tree can be obtained from the preceding tree by at most three operations. Each operation consists of a deletion of a vertex and an addition of a vertex. By using the algorithm for each diameter 2,3,⋯, n−1, we can generate all trees with n vertices.