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
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
@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?
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.
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...
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.
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
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
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?
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. 🙃
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
Lets continue the habit of commenting “understood” if you got the entire video.
Do follow me at Instagram: striver_79
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
please reply ...............................................................................
Concept of graph never changes. He started from basics. Continue watching this series.
@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
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
Kunal has a good one
understood!!! but no code for java people!!
Sir there has been a typo in your video
to print all the edges the first for loop shall have i
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
Understood! Great explanation as always, thank you so much!!
was struggling to understand the basic from the last 2 days, finally got concept through this video
@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?
we can use Arrays of list same as u did in c++ using vector -->List list[]=new ArrayList[n];
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.
Understood! Great explanation
hey striver please make a video on how to participate or the steps required to register in icpc please.
3/56 done (3.12.22)
Understood🌻
Notes link in this attached of C++ language, please update it with java language.
understood great explanation
Awesome explanation striver...... Pleass continue this series..... 😌
understood by slight modification in code the first loop should run less than or equal to n times
Can't we use map for weighted graph?
Understood, thanks a lot!
Understood 😊
understood the whole part! Thank you so much.
very nice bro.. plz continue full Java DSA
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...
Understood!
great explanation as always !
Thank you sir
Thank you very much. You are a genius.
Understood, Awsome content, keep going 🙌
Great explanation!
Thank you very much for these quality content💙💜💙
great explanation
understood very well...
Thanks a lot. Understood.
Understood, thanks a lot
Understood SIr!
understood!
m is the no of edges .so why are u assuming three in all cases??
Understood
Very nice explanation brother.
bhai notes hai kya??
Understood ! What if an edge has no weight in the matrix do we say 0
how do we add the nodes to inner array if we have a graph the has bidirectionak and directional edges?
Understood Bhaiya
tysm sir
Understood sir🙇♂❤🙏
at 20:03 you got us
Understood day 1
#Striver rocks 🤟
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.
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
UNDERSTOOD
awesome content bro ... 😍
understood
understood striver!!
Best content as always
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
first define the class to create object and use
Hashmap mp = ..... ;
UNDERSTOOD❤️
Excellent
Under stood , but do in need to to fill first adj Matrix with Zero.
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?
yeah
dada wese app
padate accha ho
completed !!!
Understood:)
Complete dp with java also
Sir how this graph serious is different from your previous graph series ??
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. 🙃
US
Bro what about c++
G2 is on C++
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
Please Add code for java coders
mast bhai
mera placement hone ke baad mujhe party dena
You have already uploaded graph series last year
Why are you uploading new again
understood but no code for java people
"us"
but there is no pair in java bhaiya ???
use ArrayLisT, and then push two element at a time
undrestood
Us
1st comment
Understood
understood
Understood!
understood!
US
Understood
Understood
Understood
Understood
understood
understood
understood
understood
Understood
Understood
Understood
Understood
Understood
Understood
Understood
understood
understood