graphit/graph_algorithms.py
def size(graph, weight=None, is_directed=None):
    """
    The graph `size` equals the total number of edges it contains

    :param graph:   graph to calculate size for
    :type graph:    :graphit:Graph
    :param weight:  edge attribute name containing a weight value
    :type weight:   :py:str

    :return:        graph size
    :rtype:         :py:int, :py:float
    """

    if is_directed is None:
        is_directed = graph.is_directed()

    graph_degree = degree(graph, weight=weight)
    graph_size = sum(graph_degree.values())

    if is_directed:
        return graph_size

    return graph_size // 2 if weight is None else graph_size / 2

    The graph `size` equals the total number of edges it contains

    :param graph:   graph to calculate size for
    :type graph:    :graphit:Graph
    :param weight:  edge attribute name containing a weight value
    :type weight:   :py:str

    :return:        graph size
    :rtype:         :py:int, :py:float
    
The graph `size` equals the total number of edges it contains
The graph ` size ` equals the total number of edges it contains
def size(graph, weight=None, is_directed=None):
    if is_directed is None:
        is_directed = graph.is_directed()
    graph_degree = degree(graph, weight=weight)
    graph_size = sum(graph_degree.values())
    if is_directed:
        return graph_size
    return graph_size // 2 if weight is None else graph_size / 2
def size ( graph , weight = None , is_directed = None ) : if is_directed is None : is_directed = graph . is_directed ( ) graph_degree = degree ( graph , weight = weight ) graph_size = sum ( graph_degree . values ( ) ) if is_directed : return graph_size return graph_size // 2 if weight is None else graph_size / 2
The graph `size` equals the total number of edges it contains
The graph ` size ` equals the total number of edges it contains
"""
    The graph `size` equals the total number of edges it contains

    :param graph:   graph to calculate size for
    :type graph:    :graphit:Graph
    :param weight:  edge attribute name containing a weight value
    :type weight:   :py:str

    :return:        graph size
    :rtype:         :py:int, :py:float
    """
None
:py:int, :py:float
graph
graph to calculate size for
graph to calculate size for
weight
edge attribute name containing a weight value
edge attribute name containing a weight value
is_directed