is_weighted: Is the graph weighted?

View source: R/weights.R

is_weightedR Documentation

Is the graph weighted?

Description

Is the graph weighted?

Usage

is_weighted(graph)

Arguments

graph

The graph.

Examples

G <- graph(
  data.frame(
    stringsAsFactors = FALSE,
    id = c("a", "b", "c", "d")
  ),
  data.frame(
    stringsAsFactors = FALSE,
    from   = c("a", "a", "b", "b", "c"),
    to     = c("b", "d", "d", "c", "a"),
    weight = c( 1 ,  2 ,  1 ,  3 ,  2 )
  )
)
is_weighted(G)

G2 <- graph(
  data.frame(
    stringsAsFactors = FALSE,
    id = c("a", "b", "c", "d")
  ),
  data.frame(
    stringsAsFactors = FALSE,
    from   = c("a", "a", "b", "b", "c"),
    to     = c("b", "d", "d", "c", "a")
  )
)
is_weighted(G2)

simplegraph documentation built on Aug. 31, 2023, 9:07 a.m.