Class WeightedSpanningTreeIterator

java.lang.Object
org.graph4j.spanning.WeightedSpanningTreeIterator
All Implemented Interfaces:
Iterator<Collection<Edge>>
Direct Known Subclasses:
MinimumSpanningTreeIterator

public class WeightedSpanningTreeIterator extends Object implements Iterator<Collection<Edge>>
Iterates over all spanning trees of a graph, in ascending or descending order by their weight. The iterator returns the collection of edges of a spanning tree, which can be used to create the actual tree with the method Graph.subgraph(java.util.Collection). See: G.K. Janssens, K. Sörensen, An algorithm to generate all spanning trees in order of increasing cost, Pesquisa Operacional, 2005-08, Vol. 25 (2), p. 219-229, https://www.scielo.br/j/pope/a/XHswBwRwJyrfL88dmMwYNWp/?lang=en
Author:
Cristian Frăsinaru
See Also:
  • Field Details

  • Constructor Details

    • WeightedSpanningTreeIterator

      public WeightedSpanningTreeIterator(Graph graph)
      Creates an iterator over the spanning trees of the specified graph, in ascending order of their weight.
      Parameters:
      graph - the input graph.
    • WeightedSpanningTreeIterator

      public WeightedSpanningTreeIterator(Graph graph, boolean ascending)
      Creates an iterator over the spanning trees of the specified graph, in ascending or descending order by their weight.
      Parameters:
      graph - the input graph.
      ascending - true if the spanning trees are returned in ascending order by their weight, false if the order should be descending.
  • Method Details