eulerian {eulerian}R Documentation

Method for finding an eulerian path or cycle.

Description

An eulerian path is a path in a graph which visits every edge exactly once. This function returns an eulerian path from a graph (if there is any). It works for both directed and undirected graphs.

Usage

	eulerian(graph, start = NULL)

Arguments

graph

a graphNEL object.

start

character or NULL. The name of the start node of an eulerian path.

Details

If start is not NULL, then eulerian returns a path starting from it. Otherwise, the start node is automatically selected.

Value

A character vector representing an eulerian path/cycle in graph. Each entry in the vector represents the name of a node in the graph.

Author(s)

Ashis Saha

Examples

	require(graph)
	require(eulerian)
	g <- new("graphNEL", nodes=LETTERS[1:4], edgemode="uirected")
	g <- addEdge(graph=g, from=LETTERS[1:3], to=LETTERS[2:4])
	ep <- eulerian(g)
	
	g <- new("graphNEL", nodes=as.character(1:10), edgemode="directed")
	g <- addEdge(graph=g, from=c("1","2","2","3","4","5","6","6","7","8","9","10"), 
			to=c("10","1","6","2","2","4","5","8","9","7","6","3"))
	ep <- eulerian(g, "6")

[Package eulerian version 1.0 Index]