Skip to content

Adds functions for computing cycle space basis - #1538

Closed
jfinkels wants to merge 6 commits into
networkx:masterfrom
jfinkels:cycle_basis_matrix
Closed

jfinkels wants to merge 6 commits into
networkx:masterfrom
jfinkels:cycle_basis_matrix

Conversation

@jfinkels

Copy link
Copy Markdown
Contributor

This pull request supercedes pull request #1067 to fix issue #1046. As stated in my comment on the former, a fix to #330 would greatly simplify the chords() algorithm below.

@jfinkels

Copy link
Copy Markdown
Contributor Author

There is an algorithm for finding a directed cycle basis here.

@kakila

kakila commented Jul 31, 2015

Copy link
Copy Markdown

Thanks for all the work. In #1067 you gave two suggestions for chords() and fundamental_cycles() are those still in force?
Is #330 being resolved? making chords() simpler would be great.
What code should I clone to work on your latest version?

@jfinkels

jfinkels commented Aug 4, 2015

Copy link
Copy Markdown
Contributor Author

My three comments were, briefly, as follows.

  1. chords() would be simpler if there were a edge_subgraph() function. I don't think anyone is working on creating an edge_subgraph() function, but the comment I left on edge_subgraph() (migrated from Trac #333) #330 seems to indicate that one may exist already. It would be great if someone could take that code, add some tests and documentation and create a pull request for it. If an edge_subgraph() gets merged before this code does, then this pull request should be updated to incorporate it, but if no edge_subgraph() function appears in time, it's fine without it.
  2. There should be a function for computing fundamental cycles. This can come later as a separate pull request that depends on this one.
  3. Allow specifying a pre-computed spanning tree. This seems to be done already for two of the functions; I'm not sure if it makes sense for the other ones.

To make changes on top of these commits, you can checkout the cycle_basis_matrix branch of my repository, jfinkels/networkx. I believe you can also make a separate pull request to that branch on my repository if you want to suggest changes to be incorporated into this pull request.

@jfinkels

Copy link
Copy Markdown
Contributor Author

The chords() function introduced in this pull request would simplify pull request #1649, in which the _min_cycle_basis() function computes chords manually.

@kakila

kakila commented Aug 31, 2015

Copy link
Copy Markdown

Regarding your suggestions.

  1. I am working on this.
  2. Isn't cycle_basis doing this?
  3. Since cycle_basis calls chords when the input is a multigraph. It makes sense to accept an optional tree (I've done this). The other functions, in their current implementation do not seem to rely on a tree of the graph.

There is a TODO asking whether chords should return a graph of a list of edges. My logic was that on the chords graph one would like to have graph methods available, like edges_iter in cycle_basis_matrix. It also allows the user to directly operate on graphs, instead of first creating it from the edges. So if you are not against it I would remove that TODO.

I sent a pull request to add these minimal changes.

@kakila

kakila commented Aug 31, 2015

Copy link
Copy Markdown

It seems that #1740 covers comment 1.

@kakila

kakila commented Aug 31, 2015

Copy link
Copy Markdown

@jfinkels if you merge branch edge-subgraph with this branch I can reduce chords to a simpler function. Provided there is no negative impact in performance (which I think it wont).

@dschult

dschult commented Feb 7, 2016

Copy link
Copy Markdown
Member

Cycle_basis_matrix can use features from #1740.
Also the add_path changes seem to have caused conflicts.

@kakila

kakila commented Feb 7, 2016

Copy link
Copy Markdown

@dschult where would you use #1740. In the function chords to return the subgraph?

@dschult

dschult commented Apr 22, 2016

Copy link
Copy Markdown
Member

This has been superceded by #2069

@dschult dschult closed this Apr 22, 2016
@dschult dschult mentioned this pull request Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants