Skip to main content
added 444 characters in body
Source Link
Martin Ender
  • 8.9k
  • 1
  • 36
  • 61

I believe what you're seeing is a valid solution. Fundamental cycles are defined with respect to a spanning tree. In fact, the documentation says about FindFundamentalCycles:

FindFundamentalCycles uses the result of FindSpanningTree as the default spanning tree.

A fundamental cycle is then defined as a cycle that uses one edge not in the tree and the corresponding unique path through the tree. Let's look at the spanning tree:

HighlightGraph[g, FindSpanningTree@g, GraphHighlightStyle -> "Thick"] 

enter image description here

We can see that your output is consistent with this spanning tree. The fundamental cycles correspond to the missing edges, {10, 11}, {14, 15}, {6, 8} and {5, 6}, respectively.

You can also convince yourself that these fundamental cycles do indeed form a valid cycle basis: by taking the symmetric difference between cycles 3 and 4, you'll obtain the cycle you're looking for.

Of course this means that the set of fundamental cycles is not unique. Start from a different spanning tree, and you'll get different cycles. I suppose what you're looking for is a set of fundamental cycles with minimal overall length (or weight). Unfortunately, it doesn't appear that FindFundamentalCycles comes with any options to look for such a solution specifically (or to use a different spanning tree as the basis). If I find some time later, I'll try to code up a solution for this, but at least I hope I've convinced you that this behaviour is not a bug.

In the meantime have a look at Wikipedia which describes a polynomial-time algorithm to find a minimal cycle basis. However, it seems that this isn't necessarily a fundamental cycle basis. According to the subsequent section finding a minimum-weight fundamental cycle basis is actually NP-hard. I guess which route you're taking here depends on what your actual goal is.

I believe what you're seeing is a valid solution. Fundamental cycles are defined with respect to a spanning tree. In fact, the documentation says about FindFundamentalCycles:

FindFundamentalCycles uses the result of FindSpanningTree as the default spanning tree.

A fundamental cycle is then defined as a cycle that uses one edge not in the tree and the corresponding unique path through the tree. Let's look at the spanning tree:

HighlightGraph[g, FindSpanningTree@g, GraphHighlightStyle -> "Thick"] 

enter image description here

We can see that your output is consistent with this spanning tree. The fundamental cycles correspond to the missing edges, {10, 11}, {14, 15}, {6, 8} and {5, 6}, respectively.

You can also convince yourself that these fundamental cycles do indeed form a valid cycle basis: by taking the symmetric difference between cycles 3 and 4, you'll obtain the cycle you're looking for.

Of course this means that the set of fundamental cycles is not unique. Start from a different spanning tree, and you'll get different cycles. I suppose what you're looking for is a set of fundamental cycles with minimal overall length (or weight). Unfortunately, it doesn't appear that FindFundamentalCycles comes with any options to look for such a solution specifically (or to use a different spanning tree as the basis). If I find some time later, I'll try to code up a solution for this, but at least I hope I've convinced you that this behaviour is not a bug.

I believe what you're seeing is a valid solution. Fundamental cycles are defined with respect to a spanning tree. In fact, the documentation says about FindFundamentalCycles:

FindFundamentalCycles uses the result of FindSpanningTree as the default spanning tree.

A fundamental cycle is then defined as a cycle that uses one edge not in the tree and the corresponding unique path through the tree. Let's look at the spanning tree:

HighlightGraph[g, FindSpanningTree@g, GraphHighlightStyle -> "Thick"] 

enter image description here

We can see that your output is consistent with this spanning tree. The fundamental cycles correspond to the missing edges, {10, 11}, {14, 15}, {6, 8} and {5, 6}, respectively.

You can also convince yourself that these fundamental cycles do indeed form a valid cycle basis: by taking the symmetric difference between cycles 3 and 4, you'll obtain the cycle you're looking for.

Of course this means that the set of fundamental cycles is not unique. Start from a different spanning tree, and you'll get different cycles. I suppose what you're looking for is a set of fundamental cycles with minimal overall length (or weight). Unfortunately, it doesn't appear that FindFundamentalCycles comes with any options to look for such a solution specifically (or to use a different spanning tree as the basis). If I find some time later, I'll try to code up a solution for this, but at least I hope I've convinced you that this behaviour is not a bug.

In the meantime have a look at Wikipedia which describes a polynomial-time algorithm to find a minimal cycle basis. However, it seems that this isn't necessarily a fundamental cycle basis. According to the subsequent section finding a minimum-weight fundamental cycle basis is actually NP-hard. I guess which route you're taking here depends on what your actual goal is.

Source Link
Martin Ender
  • 8.9k
  • 1
  • 36
  • 61

I believe what you're seeing is a valid solution. Fundamental cycles are defined with respect to a spanning tree. In fact, the documentation says about FindFundamentalCycles:

FindFundamentalCycles uses the result of FindSpanningTree as the default spanning tree.

A fundamental cycle is then defined as a cycle that uses one edge not in the tree and the corresponding unique path through the tree. Let's look at the spanning tree:

HighlightGraph[g, FindSpanningTree@g, GraphHighlightStyle -> "Thick"] 

enter image description here

We can see that your output is consistent with this spanning tree. The fundamental cycles correspond to the missing edges, {10, 11}, {14, 15}, {6, 8} and {5, 6}, respectively.

You can also convince yourself that these fundamental cycles do indeed form a valid cycle basis: by taking the symmetric difference between cycles 3 and 4, you'll obtain the cycle you're looking for.

Of course this means that the set of fundamental cycles is not unique. Start from a different spanning tree, and you'll get different cycles. I suppose what you're looking for is a set of fundamental cycles with minimal overall length (or weight). Unfortunately, it doesn't appear that FindFundamentalCycles comes with any options to look for such a solution specifically (or to use a different spanning tree as the basis). If I find some time later, I'll try to code up a solution for this, but at least I hope I've convinced you that this behaviour is not a bug.