def get_edge(from_node, to_node, properties, edge_relationship_name, encoder):
    """converts a NetworkX edge into a Geoff string.

    :param from_node: the ID of a NetworkX source node
    :param to_node: the ID of a NetworkX target node
    :param properties: a dictionary of edge attributes
    :param edge_relationship_name: string that describes the
        relationship between the two nodes
    :param encoder: an instance of a JSON encoder (e.g.
        `json.JSONEncoder`)
    :rtype: A Geoff string
    """
    edge_string = None
    if properties:
        args = [from_node, edge_relationship_name, encoder.encode(properties), to_node]
        edge_string = "({0})-[:{1} {2}]->({3})".format(*args)
    else:
        args = [from_node, edge_relationship_name, to_node]
        edge_string = "({0})-[:{1}]->({2})".format(*args)

    return edge_string