def max_endtime(graph):
    """
        A method to calculate the maximum endtime of a network.

        Parameter(s):
        -------------
        graph : TemporalDiGraph
                A directed, temporal graph.

        Returns:
        --------
        maxEndtime : int
            the maximum endtime of a network.

    """

    timespan = graph.edges.timespan()
    maxEndtime = timespan[-1]

    return maxEndtime