Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Jun 2016
    Posts
    196

    What is difference between Graph and Tree?

    Hi Guys, I'm reading my course book and I find Tree is quite similar to graph. it look me like a uni-directional non-circular connected graph. But, still i'm amazed with the thought if tree is a graph then why we need to put more focus on this graph and whole graph chapter separately? is there something that make tree a very important data structure in computer science?

  2. #2
    Senior Member
    Join Date
    Jul 2016
    Posts
    100
    A Tree is just a restricted form of a Graph.

    Trees have direction (parent / child relationships) and don't contain cycles. They fit with in the category of Directed Acyclic Graphs (or a DAG). So Trees are DAGs with the restriction that a child can only have one parent.

    One thing that is important to point out, Trees aren't a recursive data structure. They can not be implemented as a recursive data structure because of the above restrictions. But any DAG implementation, which are generally not recursive, can also be used. My preferred Tree implementation is a centralized map representation and is non recursive.

    Graphs are generally search breath first or depth first. The same applies to Tree.
    With this toolkit, you can optimize on-page SEO on your website
    My Review
    Igloo App Building your page easier- SSee my Igloo ReviewReview
    Feed Back tool allows you to ethically spy Convertifire Review

  3. #3
    Registered User
    Join Date
    Feb 2014
    Location
    delhi
    Posts
    572
    In simple words, tree does not contain cycles and where as graph can. So when we do search, we should avoid cycles in graphs so that we don't get into infinite loops.

    Another aspect is tree will typically have some kind of topological sorting or a property like binary search tree which makes search so fast and easy compared to graphs.

  4. #4
    Senior Member
    Join Date
    Aug 2016
    Posts
    126
    Tree is a special case of graph having no loops, no circuits and no self-loops.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.