What is the best data structure for the following problem?
a=["how","are","you"] b=["are","you","okay"]
given these two lists i want to construct a directed graph like
how->are->you->okay
Requirements
- I want to store a data in the nodes
- I want to assign a weight to the edges
- I want to find the data stored in node,given the key(eg 'how')
- I want to get the edge weight,given the nodes to which the edge is connected(eg given 'how' and 'are',I want to know the edge weight)
Aucun commentaire:
Enregistrer un commentaire