473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

A flooding/echo algorithm in graphs/trees

He everyone!

My question is quite simple: is there an algorithm that does exactly what's shown on this picture:



I thought about using BFS or IDDFS that "backtrack" after reaching all the leaves of the graph. Is there a better way to compute this algorithm?
Nov 13 '08 #1
2 3243
oler1s
671 Expert 512MB
You're not really searching for anything here. You just need a recursive echo. Are you guaranteed two or less children for every node. Actually, it's irrelevant, but it does simplify the code you write.

In any case, it's a recursive algorithm. If you're having trouble, work your way up. Start with a tree with only one node. Then a node with one child. Then two children. And keep expanding the tree. You should be able to formulate a proper recursive algorithm. It's nothing special.
Nov 13 '08 #2
Ganon11
3,652 Expert 2GB
It looks like the algorithm just marks a node with how many children it has, which shouldn't even take that much work in the recursive function. I could be wrong, though, the example provided was fairly simple.
Nov 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: sasha.mal | last post by:
Hello everybody! Could anyone help with a practical graph isomorphism algorithm, coded in C++ (C would also do), to work with genus bounded graphs of a bounded degree. Currently, any...
4
by: sasha.mal | last post by:
Hello everybody! Could anyone help with a practical graph isomorphism algorithm, coded in C++ (C would also do), to work with genus bounded graphs of a bounded degree. Currently, any...
6
by: Tamir Khason | last post by:
I have parent-child hashtable with more then 900K items and I have to build all pathes for this. E.G Key ParentKey 1 0 2 1 3 2 4 8 5 3 6 1 7 ...
1
by: dasarisrikar | last post by:
Hi, I am a basic learner in c and datastrustures..... I want to know the conepts of trees, graphs... could u provide me a proper tutorial or a good link which discusses trees and graphs concepts...
2
by: nallen05 | last post by:
A friend and I developed a method of querying graphs of data stored in a database with tree-regular expressions (using an XML syntax based on RELAX NG). We are trying to start a startup to...
3
momotaro
by: momotaro | last post by:
Could some one explain to me what are the criteria to choose array implementation or linked lists implementation or trees implementation or graphs implementation…? THK!
4
prometheuzz
by: prometheuzz | last post by:
Hello (Java) enthusiasts, In this article I’d like to tell you a little bit about graphs and how you can search a graph using the BFS (breadth first search) algorithm. I’ll address, and...
3
by: atyndall | last post by:
Ok, I still need help with these session varibles that I started to ask about in my previous post (http://www.thescripts.com/forum/showthread.php?p=2790429) I need that one little thing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.