Sign Up

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

You must login to add post.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Find Authority

Find Authority Logo Find Authority Logo

Find Authority Navigation

  • Home

Mobile menu

Close
Ask a Question
  • Home
  • Recent Questions
  • Topics
  • Home
Home/Questions/Q 2244
Next
In Process
Anonymous
  • 0
Anonymous
Asked: January 12, 20202020-01-12T20:39:16+00:00 2020-01-12T20:39:16+00:00In: Information Technology, Telecommunications

What is the difference between tree and graph in algorithms?

  • 0

Graph and tree, both are the types of representations use to draw the relationship between two or many objects. Both are usually used to represent different algorithms in a logical structure. Both are consist of nodes or objects and edges, used to draw the relationship between nodes. Edges may be weighted, the weight of the edge is defined, or un-weighted, weight of the edge is undefined.

difference betweennetworking
  • 1 1 Answer
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Oldest
    1. Shahkar Level 5
      2020-01-12T20:57:14+00:00Added an answer on January 12, 2020 at

      The difference between tree and graph is explained below.

      Graph

      It is used for the representation of non-linear data structure. There are different types of graphs used for various purposes, such as non-directed, directed, non-connected, connected, multi-graph, and simple graph.

      A graph has a unidirectional or bidirectional path between two nodes. There is no concept of the root node in graphs and has the ability to facilitate loops and self-loops. It contains self-loops and loops, so the graph is considered difficult to manage. The traversing in graphs can be done through the techniques, such as DFS (depth-first search) and BFS (breadth-first search). There is no method to predefine the number of edges that a graph will contain, as it totally depends on the structure of the graph. The structure of the graph looks like a network model. In the graph, a node has the ability to possess any number of edges.

      Some of the real-life applications of graph include graphs in chemistry (where it is used to represent bonds between atoms), defining network security, route maps of airlines, scheduling of timetable, modelling of sensor networks and circuits, and to find the shortest path in the network model.

      Tree vs Graph

      Tree

      It is also a type of representation that uses vertices and edges to define the relationship between objects, but the main difference is in the structure of the tree. In tree representation, the nodes are arranged in a sorted manner. There are different types of tree used for the representation of nodes, in which some includes threaded binary tree, binary tree, AVL tree, binary search tree, and B-tree.

      A tree has an only unidirectional path between two nodes, parent to child. There is a concept of the root node in a tree, from which all the nodes are inherited, and every child has only one parent. There is no concept of loops, between nodes and also self-loops. Trees are simple to manage as compared to the graph, due to not having any loops which can make it quite difficult.

      Roots and Children nodes

       

      The tree can be traversed through pre-order (PLR, parent left-right), in-order (LPR, left parent right), and post-order (LRP, left-right parent) techniques. The total number of edges in trees can find out through the formula n-1, where n is the total number of nodes in that tree. The structure of the tree is in a hierarchal manner, parent-child. In general trees, there may have a parent with many children, but in the case of binary trees, there are only two children, left and right, attached to one parent.

      The real-life application of trees includes various games, compression of data, storage of file, computer chess games, areas that require fast searching, indexing in databases, use in compilers, and use in routers to store routing information.

       

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Advanced Search
    Ask A Question

    Related Questions

    • Do I need technical skills to use a Video Production ...

    • Customer Login Using FME Extensions in Magento 2

    • E-Commerce Migration is Difficult. How to Make it Easy?

    • What is the impact of the pandemic on global LMS ...

    • How big is the global mobile middleware market?

    Explore

    • Home
    • Recent Questions
    • Topics

    Footer

    Find Authority

    Find Authority

    Find Authority is a professional networking and crowdsourcing platform which helps enhance members credentials and create opportunities.

    About Us

    • About Us
    • Careers
    • Contact Us

    Legal Stuff

    • Terms and Conditions
    • Privacy Policy
    • Cookie Policy

    Supprt

    • Help Centre
    • Badges

    Follow

    © 2020 Find Authority. All Rights Reserved

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.