def get_edge_string(edge, is_incoming_edge, to_node=True):
    """
    Create string representing the edge.
    :param edge: Edge object
    :param is_incoming_edge: Boolean, True if edge is incoming from the perspective of a node
    :param to_node: Boolean, output both from and to node labels if True
    :return: String representing the edge
    """

    if to_node:
        return "%s,%s,%s,%d" % (edge.from_node.label, edge.to_node.label, edge.label, 1 if is_incoming_edge else 0)
    else:
        return "%s,%s,%d" % (edge.from_node.label, edge.label, 1 if is_incoming_edge else 0)