hasEulerianCycle {eulerian} | R Documentation |
Method for checking whether an eulerian cycle exists.
Description
An eulerian cycle is a path in a graph which visits every edge exactly once, and starts and ends at the same node.
Usage
hasEulerianCycle(graph)
Arguments
graph |
a |
Details
A graph will have an euler cycle if and only if every node has same number of edges entering into and going out of it.
Value
TRUE
, if graph has an auler cycle. FALSE
, otherwise.
Author(s)
Ashis Saha
Examples
require(graph)
require(eulerian)
g <- new("graphNEL", nodes=LETTERS[1:4], edgemode="directed")
g <- addEdge(graph=g, from=LETTERS[1:4], to=LETTERS[c(2:4,1)])
hasEulerianCycle(g)
[Package eulerian version 1.0 Index]