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

Merged
merged 12 commits into from
Oct 12, 2024

Conversation

s-s-sawant
Copy link
Contributor

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
Contributor 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
Contributor 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 4892701; 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
Contributor 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

src/sage/graphs/graph.py Outdated Show resolved Hide resolved
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.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 9, 2024
…ion of a graph

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

<!-- ^ Please provide a concise and informative title. -->
Tutte symmetric function of a graph

<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
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.

<!-- v Why is this change required? What problem does it solve? -->
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

- [x] The title is concise and informative.
- [x] 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 "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code"
    
URL: sagemath#38677
Reported by: Sagar Sawant
Reviewer(s): David Coudert, Sagar Sawant, Travis Scrimshaw
@vbraun vbraun merged commit 9e12f55 into sagemath:develop Oct 12, 2024
20 checks passed
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.

5 participants