Skip to content

mean_indegree

Syntax

mean_indegree(network)

Parameters

network
The network to find the mean indegree for.

Returns

Returns the mean indegree of the network.

Description

Returns the decimal mean indegree of the specified network. The indegree 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_indegree(my_network))

        wait(0)
        default(Excluded)
    }
}

See Also