Method for checking whether an eulerian path exists.

Share:

Description

An eulerian path is a path in a graph which visits every edge exactly once.

Usage

1

Arguments

graph

a graphNEL object.

start

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

Details

If start is NULL, this function returns whether there exists any eulerian path in graph. If start is not NULL, the function determines if there exists an eulerian path starting from start.

Value

TRUE, if there is an eulerian path. FALSE, otherwise.

Author(s)

Ashis Saha

Examples

1
2
3
4
5
6
	require(graph)
	require(eulerian)
	g <- new("graphNEL", nodes=LETTERS[1:4], edgemode="undirected")
	g <- addEdge(graph=g, from=LETTERS[c(1:4)], to=LETTERS[c(2:4,4)])
	hasEulerianPath(g)	#TRUE
	hasEulerianPath(g, "B")	#FALSE