# Question

Formatted question description: https://leetcode.ca/all/269.html

 269	Alien Dictionary

There is a new alien language which uses the latin alphabet.
However, the order among letters are unknown to you.

You receive a list of words from the dictionary, where words are sorted lexicographically
by the rules of this new language.

Derive the order of letters in this language.

For example,

Given the following words in dictionary,
[
"wrt",
"wrf",
"er",
"ett",
"rftt"
]

The correct order is: "wertf".

Input:
[
"z",
"x",
"z"
]

Output: ""

Explanation: The order is invalid, so return "".

Note:
You may assume all letters are in lowercase.
If the order is invalid, return an empty string.
There may be multiple valid order of letters, return any one of them is fine.

@tag-graph


# Algorithm

It is actually a problem of directed graph traversal.

For each node in the directed graph, calculate its in-degree, and then start BFS traversing the directed graph from the node with an in-degree of 0, and then save the traversal path and return.

Java