Skip to content

mean_outdegree

Syntax

mean_outdegree(network)

Parameters

network
The network to find the mean outdegree for.

Returns

Returns the mean outdegree of the network.

Description

Returns the decimal mean outdegree of the specified network. The outdegree of a vertex is defined as the number of incoming edges incident on a vertex in a directed graph.

Examples

simulation {
    start_date = 2020-Jan-01
    end_date = 2020-Jan-01
    locations = none
    default_model = none
}

network my_network {
    is_directed = 1
}

condition TestCondition {
    start_state = Excluded
    meta_start_state = MetaStart

    state MetaStart {
        # Make complete triangular graph
        add_edge(my_network, 1, 2)
        add_edge(my_network, 2, 1)
        add_edge(my_network, 2, 3)
        add_edge(my_network, 3, 2)
        add_edge(my_network, 3, 1)
        add_edge(my_network, 1, 3)

        # Add an extra edge hanging off the triangle
        add_edge(my_network, 1, 4)

        wait(0)
        default(PrintDegrees)
    }

    state PrintDegrees {
        print("1.75 == ", mean_outdegree(my_network))

        wait(0)
        default(Excluded)
    }
}

See Also