classGraph (version 0.7-5)

numOutEdges: For each Node of a Directed Graph give the Number Outgoing Edges

Description

In a directed or undirected graph, for each node count the number of edges “leaving” that nodes.

Usage

numOutEdges(g)

Value

an integer vector the same length as

nodes(g) giving the number of edges that ``go out'' from each node.

Arguments

g

an R object of class graph (from package graph).

Author

Martin Maechler

See Also

edgeL on which this function is built, and leaves, both from package graph.

Examples

Run this code
## Simplistic leaves() definition for *directed graphs* :
## { compare with graph::leaves() }
is.leaf <- function(g) numOutEdges(g) == 0 ## (also exists hiddenly..)
Leaves  <- function(g) graph::nodes(g)[is.leaf(g)]
Leaves(bGraph(4, mode = "directed"))

Run the code above in your browser using DataLab