Main Content

numedges

Number of edges in graph

Description

N = numedges(G) returns the number of edges in graph G.

example

Examples

collapse all

Use the bucky adjacency matrix to create a directed graph, and then determine how many edges the graph contains.

G = digraph(bucky)
G = 
  digraph with properties:

    Edges: [180x2 table]
    Nodes: [60x0 table]

N = numedges(G)
N = 
180

Input Arguments

collapse all

Input graph, specified as either a graph or digraph object. Use graph to create an undirected graph or digraph to create a directed graph.

Example: G = graph(1,2)

Example: G = digraph([1 2],[2 3])

Output Arguments

collapse all

Number of edges, returned as a scalar.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced in R2015b