def _convert_to_dependency_graph(sentence):
    """
    (Helper function for the Floyd Warshall algorithm).
    Computes the adjacency matrix (graph) based on the dependency graph of a sentence of tokens.
    """
    graph = {}
    for token in sentence:
        graph[token.features['id']] = {}
    for from_token in sentence:
        graph[from_token.features['id']] = {}
        for to_token, _ in from_token.features['dependency_to']:
            graph[from_token.features['id']][to_token.features['id']] = 1
            graph[to_token.features['id']][from_token.features['id']] = 1
    return graph
