<![CDATA[Java Programming Forums - The Java Community - Algorithms & Recursion]]>
http://www.javaprogrammingforums.com/
enThu, 05 May 2016 23:56:04 GMTvBulletin60http://www.javaprogrammingforums.com/images/misc/rss.png<![CDATA[Java Programming Forums - The Java Community - Algorithms & Recursion]]>
http://www.javaprogrammingforums.com/
Find the parent of a node - Tree structure
http://www.javaprogrammingforums.com/algorithms-recursion/47250-find-parent-node-tree-structure.html
Mon, 18 Apr 2016 17:09:20 GMTHi, I need help on a project about tree structure. I need to find the parent of a node in a tree, I've made some attempts but everything I can get is the root. I may post my code if It helps, but I would like to ask if someone has a working algorithm to return the parent.
]]>stefano07http://www.javaprogrammingforums.com/algorithms-recursion/47250-find-parent-node-tree-structure.htmlFinding root(source) vertices in a graph
http://www.javaprogrammingforums.com/algorithms-recursion/47243-finding-root-source-vertices-graph.html
Sun, 17 Apr 2016 17:03:40 GMTHello,

I've been tackling with this specific homework for some time now, and after 6 hours of not getting ahead at all, I decided to try my luck here.

In the homework I should be finding and counting all the trees that are in a graph, however, to get started I need to first find out all possible root vertices in the graph.
I know I should keep track of the edges of the vertices and then try to see if there are no incoming edges to the vertex. If the vertex does not incoming edges, it should be a root vertex. However I just can't figure out the algorithm to do it.

In short, I need to find all vertices in a graph that are root vertices and then save them in a collection. Then I will use that information to find out all the trees in this specific graph.

All help and suggestions are appreciated.
]]>repehttp://www.javaprogrammingforums.com/algorithms-recursion/47243-finding-root-source-vertices-graph.html