Q:

how do I take user input data as a dictionary?

So in my algorithm Im using a variable to store some graph nodes. But I want to make it as an user input.
parents = {'N1': ['N2', 'N3', 'N4'], 'N3': ['N6', 'N7'], 'N4': ['N3'], 'N5': ['N4', 'N8'], 'N6': ['N13'], 'N8': ['N9'], 'N9': ['N11'], 'N10': ['N7', 'N9'], 'N11': ['N14'], 'N12': ['N5']}

The code above should look like: 
parents = list(input("Enter vertices:"))

But this only makes a list. I need a dict of lists.

A:

You can convert a string that represents a Python literal into a proper Python object using the ast module's literal_eval. From the docs:

Safely evaluate an expression node or a string containing a Python
  literal or container display. The string or node provided may only
  consist of the following Python literal structures: strings, bytes,
  numbers, tuples, lists, dicts, sets, booleans, and None.
This can be used for safely evaluating strings containing Python
  values from untrusted sources without the need to parse the values
  oneself. It is not capable of evaluating arbitrarily complex
  expressions, for example involving operators or indexing.

from pprint import pprint
from ast import literal_eval

s = "{'N1': ['N2', 'N3', 'N4'], 'N3': ['N6', 'N7'], 'N4': ['N3'], 'N5': ['N4', 'N8'], 'N6': ['N13'], 'N8': ['N9'], 'N9': ['N11'], 'N10': ['N7', 'N9'], 'N11': ['N14'], 'N12': ['N5']}"

parents = literal_eval(s)

pprint(parents)

output
{'N1': ['N2', 'N3', 'N4'],
 'N10': ['N7', 'N9'],
 'N11': ['N14'],
 'N12': ['N5'],
 'N3': ['N6', 'N7'],
 'N4': ['N3'],
 'N5': ['N4', 'N8'],
 'N6': ['N13'],
 'N8': ['N9'],
 'N9': ['N11']}

There's also a built-in function called eval which could do this, but you should never use eval on untrusted user input because it's not secure.

Here's how to use literal_eval on user input:
from pprint import pprint
from ast import literal_eval

s = input('Enter a node dictionary: ')
parents = literal_eval(s)
pprint(parents)

demo
Enter a node dictionary: {'N1': ['N2', 'N3', 'N4'], 'N3': ['N6', 'N7'], 'N4': ['N3'], 'N5': ['N4', 'N8'], 'N6': ['N13'], 'N8': ['N9'], 'N9': ['N11'], 'N10': ['N7', 'N9'], 'N11': ['N14'], 'N12': ['N5']}
{'N1': ['N2', 'N3', 'N4'],
 'N10': ['N7', 'N9'],
 'N11': ['N14'],
 'N12': ['N5'],
 'N3': ['N6', 'N7'],
 'N4': ['N3'],
 'N5': ['N4', 'N8'],
 'N6': ['N13'],
 'N8': ['N9'],
 'N9': ['N11']}

