numOutEdges {classGraph}R Documentation

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)

Arguments

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

Value

an integer vector the same length as nodes(g) giving the number of edges that ``go out'' from each node.

Author(s)

Martin Maechler

See Also

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

Examples

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

[Package classGraph version 0.7-2 Index]