1

I have this issue that I ought to find the length of a path that starting vertex is equal to ending vertex!

I already tried this:

distances(Graph, v = 17, to = 17)

and this:

all_simple_paths(Graph,17,17)

but it doesn't work.

My graph is weighted and directed. Example data is provided in my previous post.

zx8754
  • 52,746
  • 12
  • 114
  • 209

1 Answers1

0

I understood that what I'm seeking is Eulerian cycle. This problem can be solved using "eulerian" package in R. Altough it works with package "graph" and graphNEL objects instead of igraph objects. so we need to convert an igraph object to graphNEL using following code:

graphnelled <- as_graphnel(graph)

and if we want to determine whether there is an eulerian cycle in the graph: 1- Convert the igraph object to graphNEL object 2- use the following function:

hasEulerianCycle(graphnelled)

This function returns TRUE or FALSE as response.