asGraphProperty {graph}R Documentation

Generic for converting input to graph property list

Description

This is a generic that returns converts its input to a value suitable for the property slot of the propertyHolder-class virtual class.

Usage

asGraphProperty(x, hasWeight)

Arguments

x
hasWeight TRUE or FALSE indicating that the property list must have an element named "weight"

Details

If x is a list, then all of its elements must be named. If it is a numeric vector, it is converted to a list (using as.list). If it is originally numeric, is of length one and has no names then it is converted to a list with a single element named "weight".

Value

A named list.

Author(s)

Saikat DebRoy

See Also

propertyHolder-class

Examples

asGraphProperty(2.0, hasWeight=TRUE)
asGraphProperty(c(a=1, b=2))

[Package graph version 1.8.0 Index]