numedges

Number of edges in graph

Syntax

Description

example

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

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: [180×2 table]
    Nodes: [60×0 table]

N = numedges(G)
N =

   180

Input Arguments

collapse all

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

For more information, see graph or digraph.

Example: G = graph(1,2)

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

Output Arguments

collapse all

Number of edges, returned as a scalar.

See Also

| | |

Introduced in R2015b

Was this topic helpful?