if I have a directed graph whose vertices are denoted by {1,2,3,...} and the connections between them are like this:(meaning there is a directed edge from b to a represented as a<-b)
List1: 1<-2<-3<-4<-5<-6
List2: 2<-4<-7<-6
List3: 1<-8<-7
List4: 1<-9<-2
The degree of vertex 4 is 2 (since it has a edge to 3 and 2), degree of 6 is 2 and so on. How can I compute this and store this in a dictionary in python as shown below:
dict = {}
dict{4:'2', 6:'2'}
like this. Thanks in advance.
7in that input? Given4777and4637, is it4or2?