How To Read Bidirectional Graphs

How To Read Bidirectional Graphs

This subject seems very simple to the point many may disregard how to interpret a graph adjacency list when given a matrix. This should had been very easy if you have a basic understanding of matrices. I am not to make this short article into a intro to linear algebra since myself I am little rusty on this subject but a matrix can be represented as columns and rows. Each column can be represented as axis. In a simple case, when working with 2 dimensions we working with x and y. Yet, most math books will represent each column as x1, x2, x3, ..... Based on this, we can say that is nothing but a system of equations. If we have x + 2x + 1 = 0 and another equation 2x + x =0 we can represent as: row1 [ 1 2 1 |0], row2 [2, 1, 0 |0]. However, we are to focus how to represent graph relations using matrices. So, if we have a tree node where root is connected to node 1 and node 2, and we are looking in a bidirectional graph- a graph where (A,B) and (B,A) are the same edge- we can represent as

We simple say 1 is true and 0 is false. 0 is connected to 1 and 2 and so forth. Columns and rows are vertices in this case. That way, next time you are asked, show me this tree in matrix form, you can simply formulate the matrix without needing to know linear algebra.

要查看或添加评论,请登录

Mohamed Sharif的更多文章

  • An Easier explanation for AVL Trees And Implemented Using Python

    An Easier explanation for AVL Trees And Implemented Using Python

    How To Find Parent And Children When An Array Is Given AVL trees might seem more complicated than what it seems but if…

  • Implementing A Binary Heap Using Python

    Implementing A Binary Heap Using Python

    Binary heaps are a form of binary tree but the only order that we follow is that the parent value should be either…

  • Identifying Node's Relations From Array For A Complete Binary Tree

    Identifying Node's Relations From Array For A Complete Binary Tree

    I would like to make this article more conceptual and to revise the relation of the current node value to its left…

  • Front End Development And Integration With Google API | Using Hooks, Throttle, And Dynamic Style.

    Front End Development And Integration With Google API | Using Hooks, Throttle, And Dynamic Style.

    This article can be better understood if you are an intermediate React and familiar with API Calls. In this article, I…

  • 1064. Fixed Point

    1064. Fixed Point

    https://leetcode.com/problems/fixed-point/solutions/5862817/use-binary-search-and-if-value-found-recurse-to-the-left-sin…

  • Odd Even Linked List

    Odd Even Linked List

    In this article I would like to go over a solution to solve leet code problem 328. Odd Even Linked List.

  • 1122. Relative Sort Array

    1122. Relative Sort Array

    In this problem we are given 2 arrays where the first array contains all the numbers that the second array has but the…

  • 461. Hamming Distance

    461. Hamming Distance

    In this article we are going through the Leet Code Hamming Distance problem. We are given 2 integer numbers and we are…

  • Leaf-Similar Trees

    Leaf-Similar Trees

    I will be walking through the algorithm to solve the problem of 2 nodes where we are told to find if the leaf of both…

  • Solving Leet Code 243. Shortest Word Distance

    Solving Leet Code 243. Shortest Word Distance

    In this problem, we are given a array with words and there are 2 words that already exist and the goal is to return the…

社区洞察

其他会员也浏览了