G-3. Graph Representation in Java | Two Ways to Represent

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 110

  • @takeUforward
    @takeUforward  Před 2 lety +27

    Lets continue the habit of commenting “understood” if you got the entire video.
    Do follow me at Instagram: striver_79

    • @ajeetstationajeet
      @ajeetstationajeet Před 2 lety

      If I haven’t watched your previous graph series then can I directly start from here or should I watch your previous graph series at first please reply Bhaiya

    • @ajeetstationajeet
      @ajeetstationajeet Před 2 lety

      please reply ...............................................................................

    • @ratnadeepsaha7675
      @ratnadeepsaha7675 Před 2 lety +1

      Concept of graph never changes. He started from basics. Continue watching this series.

  • @CodeMode9313
    @CodeMode9313 Před rokem +12

    @striver bhaiya at 10:03 i think there was a bit error coz we need to use the for loop for all the nodes but you used from i=1 to i

  • @rana4908
    @rana4908 Před 2 lety +14

    please do a number theory course (Modular arithmetic etc). there are no quality videos on these topics and no one explains just like how you do

    • @v5q211
      @v5q211 Před 2 lety +3

      Kunal has a good one

  • @suheabkhan2546
    @suheabkhan2546 Před 2 lety +18

    understood!!! but no code for java people!!

  • @frustrato2802
    @frustrato2802 Před rokem +6

    Sir there has been a typo in your video
    to print all the edges the first for loop shall have i

  • @adrianagaraychavez7330
    @adrianagaraychavez7330 Před 3 měsíci

    this video was simply GREAT. I really loved it, it was so much help. I hope to keep learning from you :') Greetings from a Cuban Computer Science student :3

  • @cinime
    @cinime Před 2 lety +4

    Understood! Great explanation as always, thank you so much!!

  • @rajatmehta7545
    @rajatmehta7545 Před 9 měsíci

    was struggling to understand the basic from the last 2 days, finally got concept through this video

  • @user-el6hv6em7m
    @user-el6hv6em7m Před 2 měsíci

    @striver at 8:55, I think the space complexity should be O (n + 2m) because irrespective of the number of edges we are gonna create empty lists for each of the vertex. Correct me if I am wrong?

  • @hemanthkumar516
    @hemanthkumar516 Před 10 měsíci

    we can use Arrays of list same as u did in c++ using vector -->List list[]=new ArrayList[n];

  • @vinitjain7
    @vinitjain7 Před 9 měsíci +2

    00:03 Learn how to store complex graph data in Java
    01:47 Storing a graph can be done using adjacency matrix or adjacency list.
    03:29 Adjacency matrix stores graph edges in a matrix
    05:13 Adjacency list is a space-efficient way to store graph data.
    07:00 Storing vertex neighbors in an array list
    08:41 Learn how to store an undirected and directed graph
    10:12 Weighted graphs assign values to edges
    11:44 Implementing Graph in Java
    Crafted by Merlin AI.

  • @nbavideos4487
    @nbavideos4487 Před 2 lety +1

    Understood! Great explanation

  • @gamesensei.8923
    @gamesensei.8923 Před 2 lety +1

    hey striver please make a video on how to participate or the steps required to register in icpc please.

  • @oqant0424
    @oqant0424 Před rokem +1

    3/56 done (3.12.22)

  • @shubhigupta5689
    @shubhigupta5689 Před rokem +1

    Understood🌻

  • @jitinroy2246
    @jitinroy2246 Před rokem +2

    Notes link in this attached of C++ language, please update it with java language.

  • @shauryatomer1058
    @shauryatomer1058 Před měsícem

    understood great explanation

  • @farooqshareef3466
    @farooqshareef3466 Před 2 lety

    Awesome explanation striver...... Pleass continue this series..... 😌

  • @prudhvirajmacherla9854

    understood by slight modification in code the first loop should run less than or equal to n times

  • @bubunmukherjee2857
    @bubunmukherjee2857 Před rokem +1

    Can't we use map for weighted graph?

  • @jothiprakash7960
    @jothiprakash7960 Před 2 měsíci

    Understood, thanks a lot!

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Před měsícem

    Understood 😊

  • @chandrakantkhannade7326

    understood the whole part! Thank you so much.

  • @manojhr9416
    @manojhr9416 Před 2 lety

    very nice bro.. plz continue full Java DSA

  • @devbhojani9274
    @devbhojani9274 Před 2 měsíci

    can we store the graph in a HashMap instead of an ArrayList? the space complexity will still be the same but Time Complexity will reduce incase we need to access a particular edge...

  • @genzScarlet
    @genzScarlet Před měsícem

    Understood!

  • @shripadkhandare
    @shripadkhandare Před 4 měsíci

    great explanation as always !

  • @UECAshutoshKumar
    @UECAshutoshKumar Před rokem +1

    Thank you sir

  • @vakhariyajay2224
    @vakhariyajay2224 Před rokem

    Thank you very much. You are a genius.

  • @Sillysmiles76
    @Sillysmiles76 Před rokem

    Understood, Awsome content, keep going 🙌

  • @TheCricketChap
    @TheCricketChap Před rokem

    Great explanation!

  • @p38_amankuldeep75
    @p38_amankuldeep75 Před rokem

    Thank you very much for these quality content💙💜💙

  • @samyakagarwal1777
    @samyakagarwal1777 Před rokem

    great explanation

  • @vikasbagri1225
    @vikasbagri1225 Před 2 lety

    understood very well...

  • @samuelfrank1369
    @samuelfrank1369 Před 10 měsíci

    Thanks a lot. Understood.

  • @andresfgalvis2010
    @andresfgalvis2010 Před rokem

    Understood, thanks a lot

  • @parshchoradia9909
    @parshchoradia9909 Před rokem

    Understood SIr!

  • @udayrajvadeghar8555
    @udayrajvadeghar8555 Před 3 měsíci

    understood!

  • @ShresthaSinha-pr8zv
    @ShresthaSinha-pr8zv Před 4 dny

    m is the no of edges .so why are u assuming three in all cases??

  • @dewanandkumar8589
    @dewanandkumar8589 Před 14 dny

    Understood

  • @VinayKumarcs127
    @VinayKumarcs127 Před 2 lety

    Very nice explanation brother.

  • @LoayThePhrygian
    @LoayThePhrygian Před 7 měsíci

    Understood ! What if an edge has no weight in the matrix do we say 0

  • @ramyasaichivukula6824
    @ramyasaichivukula6824 Před 8 měsíci

    how do we add the nodes to inner array if we have a graph the has bidirectionak and directional edges?

  • @mriduljain6809
    @mriduljain6809 Před rokem

    Understood Bhaiya

  • @KartikeyTT
    @KartikeyTT Před 2 měsíci

    tysm sir

  • @_hulk748
    @_hulk748 Před rokem

    Understood sir🙇‍♂❤🙏

  • @akashsahu2571
    @akashsahu2571 Před rokem

    at 20:03 you got us

  • @devesh819
    @devesh819 Před rokem

    Understood day 1

  • @user-bc6ss6gp3z
    @user-bc6ss6gp3z Před 5 měsíci

    #Striver rocks 🤟

  • @rajivpunjabi4237
    @rajivpunjabi4237 Před rokem

    Can we use sets or maps to store the associated nodes? In case of unweighted graphs we can use a Set to maintain the nodes and for weighted graphs we can use a Map where the key could be the node and value will be the weight.
    For a graph like
    / 2
    1 |
    \ 3
    Without weight - [Set{}, Set{2,3}, Set{1,3}, Set{1,2}]
    With weight - [Map{}, Map{2: X, 3: X}, Map{1: X, 3:X }, Map{1:X, 2:X}]
    So you can easily perform lookup's as well. Thanks for the video.

  • @arshansari458
    @arshansari458 Před rokem

    shouldnt the space complexity in adjacency arrayList be n2 as in worstcase there all nodes are connected so we have N+1 lists and size of each is n so n2

  • @tejth
    @tejth Před 9 měsíci

    UNDERSTOOD

  • @akhil1809
    @akhil1809 Před rokem

    awesome content bro ... 😍

  • @user-ed8bc2hg5o
    @user-ed8bc2hg5o Před měsícem

    understood

  • @hrushi_borhade
    @hrushi_borhade Před rokem

    understood striver!!

  • @rohitmalhotra2566
    @rohitmalhotra2566 Před rokem

    Best content as always

  • @saritakumari4787
    @saritakumari4787 Před 10 měsíci

    How to represent graph of Complex objects like employee or people. what will be the datatype for such adjacency list? storing just numbers may not be enough here

    • @pagal4621
      @pagal4621 Před 9 měsíci

      first define the class to create object and use
      Hashmap mp = ..... ;

  • @MrPrakash219
    @MrPrakash219 Před 2 lety

    UNDERSTOOD❤️

  • @aj9706
    @aj9706 Před 11 měsíci

    Excellent

  • @amarjeetkumar-hk2jl
    @amarjeetkumar-hk2jl Před 2 lety

    Under stood , but do in need to to fill first adj Matrix with Zero.

  • @ratnadeepsaha7675
    @ratnadeepsaha7675 Před 2 lety +3

    I have one question. Can I use the collections framework while writing codes in Online coding ide(s), those are used in Online coding exam round of Product-based or service-based companies?

  • @CodeMode9313
    @CodeMode9313 Před rokem

    dada wese app
    padate accha ho

  • @coolraviraj24
    @coolraviraj24 Před 2 lety

    completed !!!

  • @dreamyme543
    @dreamyme543 Před rokem

    Understood:)

  • @surya8731
    @surya8731 Před 2 lety

    Complete dp with java also

  • @september-jk1ps
    @september-jk1ps Před 2 lety +1

    Sir how this graph serious is different from your previous graph series ??

    • @farooqshareef3466
      @farooqshareef3466 Před 2 lety +1

      I think that series it was based on popular problems of graph such as shortest paths ....etc.and i think in this series we will learn implementation of graphs and problems on it.... Lets hope good. 🙃

  • @maddipatlamadhura1500
    @maddipatlamadhura1500 Před 18 dny

    US

  • @prajwalbs772
    @prajwalbs772 Před 2 lety +1

    Bro what about c++

  • @ankanhaldar1130
    @ankanhaldar1130 Před 6 dny

    package Graph;
    import java.util.ArrayList;
    import java.util.Scanner;
    public class graph_representaion {
    public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    System.out.print("Enter the number of vertices: ");
    int v=sc.nextInt();
    ArrayList adj=new ArrayList();
    for(int i=0; i

  • @aniketbansod8136
    @aniketbansod8136 Před 6 měsíci

    Please Add code for java coders

  • @munendragaur4965
    @munendragaur4965 Před rokem

    mast bhai
    mera placement hone ke baad mujhe party dena

  • @tle964
    @tle964 Před 2 lety

    You have already uploaded graph series last year
    Why are you uploading new again

  • @venutalla5932
    @venutalla5932 Před rokem

    understood but no code for java people

  • @rayyansyed2998
    @rayyansyed2998 Před 11 měsíci

    "us"

  • @naushadalam5129
    @naushadalam5129 Před rokem

    but there is no pair in java bhaiya ???

  • @swacharahman5084
    @swacharahman5084 Před rokem

    undrestood

  • @ankurprabhu2547
    @ankurprabhu2547 Před 2 lety

    Us

  • @BTECE_manichandT
    @BTECE_manichandT Před 2 lety

    1st comment

  • @ManideepNalumachu
    @ManideepNalumachu Před 3 měsíci

    Understood

  • @user-ed8bc2hg5o
    @user-ed8bc2hg5o Před měsícem

    understood

  • @Sakshi-nd2jz
    @Sakshi-nd2jz Před rokem

    Understood!

  • @sukhjattana5887
    @sukhjattana5887 Před rokem

    understood!

  • @vivekpawar311
    @vivekpawar311 Před 2 lety

    US

  • @himanshidafouty347
    @himanshidafouty347 Před 3 měsíci

    Understood

  • @NARUTOUZUMAKI-bk4nx
    @NARUTOUZUMAKI-bk4nx Před 8 měsíci

    Understood

  • @premduvvapu476
    @premduvvapu476 Před 8 měsíci

    Understood

  • @karanrao8956
    @karanrao8956 Před rokem

    Understood

  • @chiragbansod8252
    @chiragbansod8252 Před 7 měsíci

    understood

  • @arsalanmaulvi7170
    @arsalanmaulvi7170 Před 9 měsíci

    understood

  • @adarshkumarrao3478
    @adarshkumarrao3478 Před rokem

    understood

  • @sangeetasharma8574
    @sangeetasharma8574 Před rokem

    understood

  • @RJ-bd3ww
    @RJ-bd3ww Před rokem

    Understood

  • @komalkrishna7836
    @komalkrishna7836 Před rokem

    Understood

  • @shrunkhalaraut7789
    @shrunkhalaraut7789 Před rokem

    Understood

  • @sreyanssinghi8583
    @sreyanssinghi8583 Před rokem

    Understood

  • @shantanubose4972
    @shantanubose4972 Před rokem

    Understood

  • @KratosProton
    @KratosProton Před 2 lety

    Understood

  • @shashank820
    @shashank820 Před 2 lety

    Understood

  • @abhijeetkumar2970
    @abhijeetkumar2970 Před rokem

    understood

  • @akshaypatade5730
    @akshaypatade5730 Před 2 lety

    understood