 |
Synthia
Generic and flexible data structure generator
|
Go to the documentation of this file. 1 package ca.uqac.lif.synthia.tree;
3 import java.util.ArrayDeque;
4 import java.util.HashSet;
5 import java.util.Queue;
36 Set<Node<T>> visited =
new HashSet<Node<T>>();
37 Queue<Node<T>> to_visit =
new ArrayDeque<Node<T>>();
39 while (!to_visit.isEmpty())
41 Node<T> current = to_visit.remove();
42 if (visited.contains(current))
47 int id =
getId(current);
52 int t_id =
getId(child);
53 markov.
add(
id, t_id, 1f / degree);
54 if (!visited.contains(child) && !to_visit.contains(child))
Converts a graph into an equivalent Markov chain.
MarkovChain< T > add(int source, int destination, Number probability)
Adds a new transition to the machine.
T getLabel()
Gets the label associated to this node.
List< Node< T > > getChildren()
Gets the children of this node.
Generates a sequence of objects by a random walk in a Markov chain.
Simple implementation of a labeled nodel.
Picker< U > getPicker(T t)
Pickers related to the generation of a sequence of values.
MarkovChain< U > asMarkovChain(Node< T > start, Picker< Float > float_source)
Converts a graph into a {@linkplain MarkovChain Markov chain}.