# Python Graph Network and How It is Used

Assignment Help  3rd Jun 2020

What, you don’t understand Python Graph Network and unable to complete assignment on the topic? Take the writing help for python assignment from BookMyEssay and lessen your worries. Our team offers the best assistance for writing python assignment no matter what the topic is and what your deadline is. Our company offers assignment help through subject experts in the field of web programming, software testing and QA, computer science, data analysis, IT assignments. And our service is not limited only up to these subjects, we offer help for many other subjects such as biology, physic, chemistry, mathematics and many more.

## One of The Example of Python Graph Network We are Sharing Here

In computer science and mathematics, "graph" comprises of "nodes", which is also called as "vertices". It may or may not be linkurled with one another. In the illustration we are showing here, it is the graph pictorial representation. Here, the node "a" is linkurled with the node "c", but "a" is not linkurled with "b". The line that connects two nodes is known as edge. In case the edges present between the nodes are undirected, then the graph is called an undirected graph. One the other hand, if the edge is directed and extended from one vertex i.e. node to another, then the graph is called a directed graph. Arc is the directed edge arc. Here is the source code with an example: class Network(object): def __init__(self): self.__network_dict = {} self.__person_property = {} self.__relation_property = {} nbsp; def create_person(self): print("enter person") person = input() if person not in self.__network_dict: self.__network_dict[person] = [] #print(self.__network_dict) nbsp; def add_person_property(self, person, prop, value): if person in self.__network_dict: if person not in self.__person_property: self.__person_property[person] = {prop: value} else: self.__person_property[person].update({prop: value}) nbsp; def add_relation(self, person1, person2): if person1 and person2 in self.__network_dict: self.__network_dict[person1].append(person2) self.__network_dict[person2].append(person1) else: self.__network_dict[person1] = [person2] self.__network_dict[person2] = [person1] nbsp; def add_relation_property(self, person1, person2, prop, value): prop_set = frozenset([person1, person2]) if person1 in self.__network_dict and person2 in self.__network_dict[person1]: if prop_set not in self.__relation_property: self.__relation_property[prop_set] = {prop: value} else: self.__relation_property[prop_set].update({prop: value}) #print(self.__relation_property) nbsp; def get_person(self, name): if name in self.__network_dict: return (self.__network_dict[name]) nbsp; def friends_of_friends(self, name): # get a list of friends of friends of the person with given name friend_of_friends = [] if name in self.__network_dict: for friend in self.__network_dict[name]: friend_of_friends.append(friend) for person in self.__network_dict[friend]: friend_of_friends.append(person) #print(self.__network_dict) return list(set(friend_of_friends)) nbsp; nbsp; if __name__ == "__main__": """EXAMPLE""" network = Network() for i in range(2): network.create_person() for i in range(2): print("enter person1") person1 = input() print("enter person2") person2 = input() network.add_relation(person1,person2) print("enter persons name") print("enter person name") person1 = input() person2 = input() print("prop") prop = input() print("value") value = input() network.add_relation_property(person1, person2, prop, value) nbsp; print("enter persons name") print("enter person name") person1 = input() person2 = input() print("prop") prop = input() print("value") value = input() network.add_relation_property(person1, person2, prop, value) That is how the social network simplified model is created. We can create users easily and establish the connections between them, also add properties to both relations and users.

### More You Can Get through Assignment Help

More importance of python packages in development. Every year, hundreds of students contact our team to avail assignment help on a wide range of topics and secure good grades for themselves, We offer the best python assignment writing help service in Australia with the support of our experienced and trained staff. And our charges for this service is nominal.

### GET A FREE INSTANT QUOTE

No Word Limit

Total Pages
Words :
Example of Embedding YouTube Video inside Bootstrap Modal
SUBSCRIBE AND FOLLOW
WhatsApp
Hi there
Struggling with Assignments?