Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a method to compute the Tutte Symmetric function of a graph #38677

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

s-s-sawant
Copy link

Added a method that returns the Tutte symmetric function of the graph. Added references accordingly.

Tutte symmetric function of a graph

For a graph G (may contain multiedges and loops), the new methods returns the Tutte symmetric function of the graph. It is implemented by using the expansion of the Tutte symmetric function in the monomial symmetric function basis.
The references are added and the index.rst file is updated accordingly.

The Tutte symmetric function of a graph is a chromatic invariant that generalizes the Tutte polynomial to a symmetric function. One can recover the chromatic symmetric function of a graph from its Tutte symmetric function. Analogous to the Stanley's tree isomorphism conjecture, the graph classes distinguished by their Tutte symmetric function are actively investigated.
The newly added method returns the monomial symmetric function expansion of the Tutte symmetric function of a graph.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

No pending dependencies

Comment:

All tests are passed. However, unable to run docbuild. Shows the following error:
"File "", line 198, in _run_module_as_main
File "", line 88, in _run_code"

@s-s-sawant s-s-sawant marked this pull request as draft September 19, 2024 06:15
@s-s-sawant s-s-sawant marked this pull request as ready for review September 19, 2024 06:17
@s-s-sawant
Copy link
Author

For a graph G, its Tutte symmetric function is a chromatic invariant that generalizes the Tutte polynomial to a symmetric function.
We add a method to compute the Tutte symmetric function of a graph using its expansion in the augmented monomial symmetric function basis.

Analogous to the Stanley's tree isomorphism conjecture, determining graph classes that are distinguished by their Tutte symmetric function is actively investigated.

@tscrim @amritanshu-prasad @mantepse

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

further improvements are certainly possible.

src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
ret = m.zero()
V = self.vertices()
E = list(self.edges(labels=False))
M = Counter(E)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can certainly do directly M = Counter(self.edge_iterator(labels=False)), thus avoiding intermediate variable E which is not used elsewhere.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not changed in what I can see.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few other little things from me.

src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
ret = m.zero()
V = self.vertices()
E = list(self.edges(labels=False))
M = Counter(E)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not changed in what I can see.

src/sage/graphs/graph.py Outdated Show resolved Hide resolved
src/sage/graphs/graph.py Outdated Show resolved Hide resolved
@dcoudert
Copy link
Contributor

@tscrim, do you know why the CI is not running for this PR ? it would be useful to finalize the review. I think the code is ok now.

@mantepse
Copy link
Collaborator

@tscrim, do you know why the CI is not running for this PR ? it would be useful to finalize the review. I think the code is ok now.

because the author is a first time contributor.

src/sage/graphs/graph.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Sep 26, 2024

Documentation preview for this PR (built with commit cb6624d; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dcoudert
Copy link
Contributor

dcoudert commented Oct 4, 2024

What's the purpose of this last commit ? why is method matching in this PR ?

@s-s-sawant
Copy link
Author

What's the purpose of this last commit ? why is method matching in this P

A conflict was raised highlighting tutte_symmetric_function, matching and is_factor_critical. The new commit was made while resolving the conflict.

@dcoudert
Copy link
Contributor

dcoudert commented Oct 4, 2024

Methods matching and is_factor_critical have been moved to src/sage/graphs/matching.py in #38218.
So you should not put them back to src/sage/graphs/graph.py.

from sage.combinat.sf.sf import SymmetricFunctions
from sage.combinat.set_partition import SetPartitions
from sage.misc.misc_c import prod
from sage.arith.misc import factorial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to import factorial anymore

m = SymmetricFunctions(R).m()
ret = m.zero()
V = self.vertices()
M = Counter(list(self.edges(labels=False)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really need to get the list of edges? I thought having an iterator is sufficient.In particular, this does not match @dcoudert 's suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants