breadth-first

C# graph traversal - tracking path between any two nodes

Looking for a good approach to keep track of a Breadth-First traversal between two nodes, without knowing anything about the graph. Versus Depth-First (where you can throw away the path if it doesn't pan out) you may have quite a few "open" possibilities during the traversal. ...

Variable naming schemes for objects in C++?

Hey everyone, I am implementing a BFS, and what it is going to do is go through an ordered tree to find the shortest solution to a puzzle. What i will be doing is creating a Snapshot object that holds the current position of each piece in a puzzle. I will add this Snapshot object into the queue and check if it is the solution. However,...

TreeNode Breadth first enum?

Right now my loop is for (TreeNode n = e.Node.FirstNode; n != null; n = n.NextNode) and my data is something like a a1 a2 b b1 I want to enum breadth only (a, b etc, not a1, a2 etc). How do i do this? ...

Hibernate Search - How to list all records by default.

Hi, I am using Hibernate search. I have a search text box in my jsp page. If i enter some text, it returns correct result. But if i leave empty message and click the search button, it did not return any records. This is my code, Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); St...

How to functionally generate a tree breadth-first. (With Haskell)

Say I have the following Haskell tree type, where "State" is a simple wrapper: data Tree a = Branch (State a) [Tree a] | Leaf (State a) deriving (Eq, Show) I also have a function "expand :: Tree a -> Tree a" which takes a leaf node, and expands it into a branch, or takes a branch and returns it unaltered. Th...

Recursive breadth-first travel function in Java or C++?

Here is a java code for breadth-first travel: void breadthFirstNonRecursive(){ Queue<Node> queue = new java.util.LinkedList<Node>(); queue.offer(root); while(!queue.isEmpty()){ Node node = queue.poll(); visit(node); if (node.left != null) queue.offer(node.left); if (node.right != n...